Skip to content

Commit

Permalink
Evmsheet + argent web wallet (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementWalter authored Aug 29, 2023
1 parent 1747f8d commit 44de0b3
Show file tree
Hide file tree
Showing 138 changed files with 385,271 additions and 318,287 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and push

on:
push:
branches:
- "staging"

jobs:
starksheet-deployer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-cairo:latest
context: ./packages/starksheet-cairo
platforms: linux/amd64,linux/arm64

evmsheet-deployer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-solidity:latest
context: .
file: ./packages/starksheet-solidity/Dockerfile
platforms: linux/amd64,linux/arm64

webapp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-webapp:latest
context: ./packages/starksheet-webapp
platforms: linux/amd64,linux/arm64
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"python.testing.pytestArgs": ["packages"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"githubPullRequests.ignoredPullRequestBranches": ["staging"]
}
136 changes: 94 additions & 42 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,111 @@
services:

starknet-devnet:
image: shardlabs/starknet-devnet
ethereum:
platform: linux/x86_64
image: ghcr.io/foundry-rs/foundry
entrypoint: anvil
healthcheck:
test: ["CMD-SHELL", "if [ $(wget -qO- http://0.0.0.0:5050/is_alive) == 'Alive!!!' ]; then exit 0; else exit 1; fi"]
test: cast chain-id
interval: 5s
command:
- "--seed=0"
- "--disable-rpc-request-validation"
- "--fork-network=alpha-goerli"
ports:
- '5050:5050'
- "8545:8545"
environment:
ANVIL_IP_ADDR: "0.0.0.0"
networks:
- ethereum

starknet-deployer:
ethereum-deployer:
image: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-solidity:latest
depends_on:
starknet-devnet:
ethereum:
condition: service_healthy
build:
context: ./packages/starksheet-cairo
environment:
RPC_URL: http://ethereum:8545
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
volumes:
- ethereum-broadcast:/app/starksheet/packages/starksheet-solidity/broadcast
- ethereum-out:/app/starksheet/packages/starksheet-solidity/out
networks:
- ethereum

ethereum-webapp:
image: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-webapp:latest
depends_on:
ethereum-deployer:
condition: service_completed_successfully
working_dir: /app/starksheet/packages/starksheet-webapp
volumes:
- ./packages/starksheet-cairo/deployments:/app/deployments
- ethereum-broadcast:/app/starksheet/packages/starksheet-solidity/broadcast
- ethereum-out:/app/starksheet/packages/starksheet-solidity/out
environment:
ACCOUNT_ADDRESS: "0x7e00d496e324876bbc8531f2d9a82bf154d1a04a50218ee74cdd372f75a551a"
PRIVATE_KEY: "0xe3e70682c2094cac629f6fbed82c07cd"
STARKNET_NETWORK: "docker"
- REACT_APP_NETWORK=anvil
- REACT_APP_RPC_URL=http://0.0.0.0:8545
- PORT=3000
ports:
- "3000:3000"
networks:
- ethereum

ethereum-devnet:
image: ghcr.io/foundry-rs/foundry
starknet:
image: ghcr.io/dojoengine/dojo:v0.1.0
command:
- "katana"
- "--allow-zero-max-fee"
- "--validate-max-steps"
- "16777216"
- "--invoke-max-steps"
- "16777216"
- "--gas-price"
- "0"
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "8545"]
interval: 5s
# This is a hack to just wait 1s
test: echo "ok"
interval: 1s
ports:
- '8545:8545'
environment:
ANVIL_IP_ADDR: "0.0.0.0"
CHAIN: 1
platform: linux/x86_64
entrypoint: anvil
- "5050:5050"
networks:
- starknet

ethereum-deployer:
starknet-deployer:
image: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-cairo:latest
depends_on:
ethereum-devnet:
starknet:
condition: service_healthy
image: ghcr.io/foundry-rs/foundry
environment:
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
ETHERSCAN_API_KEY: "foobar"
ACCOUNT_ADDRESS: "0x03ee9e18edc71a6df30ac3aca2e0b02a198fbce19b7480a63a0d71cbd76652e0"
PRIVATE_KEY: "0x0300001800000000300000180000000000030000000000003006001800006600"
RPC_URL: http://starknet:5050
CHECK_INTERVAL: "0.1"
MAX_WAIT: "1"
volumes:
- ./packages/starksheet-solidity:/app
working_dir: /app
platform: linux/x86_64
entrypoint: forge
command:
- "script"
- "/app/script/Evmsheet.s.sol:EvmsheetScript"
- "--broadcast"
- "--verify"
- "--rpc-url=http://ethereum-devnet:8545"
- starknet-deployments:/app/starksheet/packages/starksheet-cairo/deployments
- starknet-build:/app/starksheet/packages/starksheet-cairo/build
networks:
- starknet

starknet-webapp:
image: ghcr.io/the-candy-shop/starksheet-monorepo/starksheet-webapp:latest
depends_on:
starknet-deployer:
condition: service_completed_successfully
working_dir: /app/starksheet/packages/starksheet-webapp
volumes:
- starknet-deployments:/app/starksheet/packages/starksheet-cairo/deployments/katana
- starknet-build:/app/starksheet/packages/starksheet-cairo/build
environment:
- REACT_APP_NETWORK=katana
- REACT_APP_RPC_URL=http://0.0.0.0:5050
- PORT=3001
ports:
- "3001:3001"
networks:
- starknet

volumes:
starknet-deployments:
starknet-build:
ethereum-broadcast:
ethereum-out:

networks:
starknet:
ethereum:
47 changes: 47 additions & 0 deletions packages/starksheet-cairo/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.DS_Store
.temp/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg

# Unit test / coverage reports
.pytest_cache/


# Environments
.env

# vscode project settings
.vscode/
tests/tokens/
calls.csv
daily_sheets.png
deployments
dust_pilots
notebooks
launch.json
tests
build
assets
allow_list.json
2 changes: 2 additions & 0 deletions packages/starksheet-cairo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ share/python-wheels/
tests/tokens/
calls.csv
daily_sheets.png
hourly_sheets.png
cumsum_sheets.png
40 changes: 19 additions & 21 deletions packages/starksheet-cairo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# pull official base image
FROM python:3.9.16-slim-buster
FROM python:3.9.13

# set work directory in the container
WORKDIR /app
# install poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="$PATH:/root/.local/bin"
RUN poetry config virtualenvs.create false

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install madara swap
WORKDIR /app/starksheet/packages/starksheet-cairo
COPY poetry.lock .
COPY pyproject.toml .
COPY scripts ./scripts
COPY README.md .
RUN poetry install
# split install in two steps to leverage docker cache
COPY . .
RUN poetry install

# install system dependencies
RUN apt-get update && apt-get install -y gcc libgmp-dev
# Build contracts
RUN python scripts/compile_starksheet.py

# install python dependencies
RUN pip install --upgrade pip
RUN pip install poetry

# copy project
COPY . /app/

# install dependencies
RUN poetry install --no-interaction --no-ansi

# command to run on container start
CMD ["poetry", "run", "python", "deploy/starksheet.py"]
# Deploy madara swap
CMD ["python", "scripts/deploy_starksheet.py"]
Loading

0 comments on commit 44de0b3

Please sign in to comment.