Skip to content

Commit

Permalink
Merge pull request #97 from metaDAOproject/develop
Browse files Browse the repository at this point in the history
Prop 15
  • Loading branch information
metaproph3t authored Apr 3, 2024
2 parents a9eaaf5 + c9e5a23 commit 26cfd2d
Show file tree
Hide file tree
Showing 37 changed files with 7,253 additions and 2,230 deletions.
57 changes: 57 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Docker image to generate deterministic, verifiable builds of Anchor programs.
# This must be run *after* a given ANCHOR_CLI version is published and a git tag
# is released on GitHub.
#

FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

ARG SOLANA_CLI="1.17.16"
ARG ANCHOR_CLI="0.29.0"
ARG NODE_VERSION="v18.16.0"

ENV HOME="/root"
ENV PATH="${HOME}/.cargo/bin:${PATH}"
ENV PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}"
ENV PATH="${HOME}/.nvm/versions/node/${NODE_VERSION}/bin:${PATH}"

# Install base utilities.
RUN mkdir -p /workdir && mkdir -p /tmp && \
apt-get update -qq && apt-get upgrade -qq && apt-get install -qq \
build-essential git curl wget jq pkg-config python3-pip \
libssl-dev libudev-dev

#RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
#RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb

# Install rust.
RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \
sh rustup.sh -y && \
rustup component add rustfmt clippy

# Install node / npm / yarn.
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
ENV NVM_DIR="${HOME}/.nvm"
RUN . $NVM_DIR/nvm.sh && \
nvm install ${NODE_VERSION} && \
nvm use ${NODE_VERSION} && \
nvm alias default node && \
npm install -g yarn

# Install Solana tools.
RUN sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI}/install)"

# Install anchor.
RUN cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
RUN avm install ${ANCHOR_CLI} && avm use ${ANCHOR_CLI}

# set up keypair
RUN solana-keygen new --no-bip39-passphrase

WORKDIR /workdir
#be sure to add `/root/.avm/bin` to your PATH to be able to run the installed binaries

# install dependencies
RUN yarn
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"build": { "dockerfile": "Dockerfile" },
}
9 changes: 5 additions & 4 deletions .github/workflows/anchor-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ name: anchor-test
on:
push:
branches:
- main
- develop
- production
pull_request:

jobs:
run-anchor-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: metadaoproject/anchor-test@v2
- uses: metadaoproject/anchor-test@v2.1
with:
anchor-version: '0.28.0'
solana-cli-version: '1.16.0'
anchor-version: '0.29.0'
solana-cli-version: '1.17.16'
57 changes: 57 additions & 0 deletions .github/workflows/generate-verifiable-builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: generate-verifiable-builds
on:
workflow_dispatch:
push:
branches:
- production
- develop

jobs:
generate-verifiable-autocrat:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: metadaoproject/anchor-verifiable-build@v0
with:
program: autocrat_v0
anchor-version: '0.29.0'
solana-cli-version: '1.17.16'
- run: 'git pull --rebase'
- run: cp target/deploy/autocrat_v0.so ./verifiable-builds
- name: Commit verifiable build back to mainline
uses: EndBug/[email protected]
with:
default_author: github_actions
message: 'Update autocrat_v0 verifiable build'
generate-verifiable-vault:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: metadaoproject/anchor-verifiable-build@v0
with:
program: conditional_vault
anchor-version: '0.29.0'
solana-cli-version: '1.17.16'
- run: 'git pull --rebase'
- run: cp target/deploy/conditional_vault.so ./verifiable-builds
- name: Commit verifiable build back to mainline
uses: EndBug/[email protected]
with:
default_author: github_actions
message: 'Update conditional_vault verifiable build'
generate-verifiable-migrator:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: metadaoproject/anchor-verifiable-build@v0
with:
program: autocrat_migrator
anchor-version: '0.29.0'
solana-cli-version: '1.17.16'
- run: 'git pull --rebase'
- run: cp target/deploy/autocrat_migrator.so ./verifiable-builds
- name: Commit verifiable build back to mainline
uses: EndBug/[email protected]
with:
default_author: github_actions
message: 'Update autocrat_migrator verifiable build'
14 changes: 11 additions & 3 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ seeds = false
skip-lint = false

[programs.localnet]
autocrat_migrator = "migkwAXrXFN34voCYQUhFQBXZJjHrWnpEXbSGTqZdB3"
autocrat_v0 = "metaX99LHn3A7Gr7VAcCfXhpfocvpMpqQ3eyp3PGUUq"
conditional_vault = "vaU1tVLj8RFk7mNj1BxqgAsMKKaL8UvEUHvU3tdbZPe"
autocrat_migrator = "MigRDW6uxyNMDBD8fX2njCRyJC4YZk2Rx9pDUZiAESt"
autocrat_v0 = "metaRK9dUBnrAdZN6uUDKvxBVKW5pyCbPVmLtUZwtBp"
conditional_vault = "vAuLTQjV5AZx5f3UgE75wcnkxnQowWxThn1hGjfCVwP"

[registry]
url = "https://api.apr.dev"
Expand All @@ -17,13 +17,17 @@ cluster = "Localnet"
wallet = "~/.config/solana/id.json"

[scripts]
initialize_dao = "yarn run ts-node scripts/initializeDao.ts"
crank_twap = "yarn run ts-node scripts/crankTwap.ts"
airdrop = "yarn run ts-node scripts/airdrop.ts"
autocrat_v0 = "yarn run ts-node scripts/autocratV0.ts"
clob = "yarn run tsc scripts/clob.ts --esModuleInterop --resolveJsonModule && node scripts/clob.js && rm scripts/clob.js"
crank = "yarn run ts-node scripts/crank.ts"
main = "yarn run ts-node scripts/main.ts"
propose = "yarn run ts-node scripts/initializeProposal.ts"
initialize_vault = "yarn run tsc scripts/initializeVault.ts --esModuleInterop --resolveJsonModule && node scripts/initializeVault.js"
place_order = "yarn run ts-node scripts/placeOrder.ts"
multisig = "yarn run tsx scripts/multisig.ts"
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/*.ts"

[test]
Expand All @@ -38,3 +42,7 @@ program = "./tests/fixtures/openbook_v2.so"
[[test.genesis]]
address = "TWAP7frdvD3ia7TWc8e9SxZMmrpd2Yf3ifSPAHS8VG3"
program = "./tests/fixtures/openbook_twap.so"

[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "./tests/fixtures/mpl_token_metadata.so"
27 changes: 22 additions & 5 deletions Cargo.lock

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

Loading

0 comments on commit 26cfd2d

Please sign in to comment.