Skip to content

Commit

Permalink
deployment to sepolia and improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thiscaspar committed Nov 25, 2024
1 parent 783c034 commit cdf46a3
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 3,146 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "My Project",
"image": "ghcr.io/pixelaw/core:0.5.7",
"image": "ghcr.io/pixelaw/core:0.5.10",
"forwardPorts": [
5050,
8080,
Expand Down
62 changes: 62 additions & 0 deletions README.local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Install Local Environment


## Prerequisites

- [asdf](https://asdf-vm.com/)
- [scarb](https://docs.swmansion.com/scarb/)
- [dojo](https://github.com/dojoengine/dojo)

## Install asdf

Follow the asdf installation instructions.

### Install dojo

```
asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo 1.0.1
```

### Install scarb

```
asdf plugin add scarb
asdf install scarb 2.7.0
```


### Running Locally

#### Terminal one (Make sure this is running)

```bash
# Run Katana
katana --dev --dev.no-fee --http.cors_origins "*"
```

#### Terminal two

```bash
# Build the example
sozo build

# Migrate the example
sozo migrate

# Initialize the pixelaw app
scarb run init_auth

# Start Torii
torii --world 0x6f130c8e150882e39cbe878c650c8f35c86579180dbc77d0c1cbe169449b5f6 --http.cors_origins "*"
```

### How to deploy

you can deploy your app to our katana testnet by running the following commands:

```bash
# Deploy the pixelaw app
sozo build -P release
sozo migrate apply -P release
```
102 changes: 30 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,90 +16,48 @@

Contracts written in Cairo using Dojo to showcase a Pixel World with app interoperability. Its interoperability is made possible with core actions. Apps are any other contracts that are deployed to the Pixel World.

## Prerequisites
## Getting started
The easiest way is to use the VSCode DevContainer, all tools will be installed already. Keep reading for this approach. You can also install all tools in your local environment, see [Local Environment](README.local.md).
This README is all about using the Devcontainer (recommended)

- [asdf](https://asdf-vm.com/)
- [scarb](https://docs.swmansion.com/scarb/)
- [dojo](https://github.com/dojoengine/dojo)
## 1. Devcontainer
Open this folder in VSCode, and build/run the devcontainer.
You will see a series of commands executed in the terminal, which you can close when done. After that you have a fully configured environment with Katana, Torii and the Pixelaw server running. Use `klog`, `tlog` and `slog` to see the logs for each.

## Install asdf

Follow the asdf installation instructions.
## 2. Accounts
When doing local development, you'll use the build-in Katana accounts which have been preconfigured.

## Install dojo
When ready to deploy to Sepolia testnet, you'll have to create and fund an account, and install the keystore file in your project.
You can use the `scripts/account_from_key.sh` for this.

```
asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo 1.0.1
```
## 3. Build/Deployment
All normal Dojo tooling is available, see the [Dojo Documentation](https://book.dojoengine.org/toolchain/sozo)

## Install scarb

```
asdf plugin add scarb
asdf install scarb 2.7.0
### 3.1 Build
This will compile the Cairo contracts in `/src`
```

And after moving into contracts directory, the versions for these libs are set in the .tool-versions file.

## Running Locally

#### Terminal one (Make sure this is running)

```bash
# Run Katana
katana --dev --dev.no-fee --http.cors_origins "*"
```

#### Terminal two

```bash
# Build the example
sozo build

# Migrate the example
sozo migrate

# Initialize the pixelaw app
scarb run init_auth

# Start Torii
torii --world 0x6f130c8e150882e39cbe878c650c8f35c86579180dbc77d0c1cbe169449b5f6 --http.cors_origins "*"
```

### How to deploy

you can deploy your app to our katana testnet by running the following commands:

```bash
# Deploy the pixelaw app
sozo build -P release
sozo migrate apply -P release
### 3.2 Deployment
Deploy (migrate) the contracts
```


## Troubleshooting

If you want to use latest dojo version, you need to clone core by yourself and modify the path in `Scarb.toml` file.

1. Clone core repo
```bash
git clone https://github.com/pixelaw/core
sozo migrate
```

2. Modify the path in `Scarb.toml` file
```Scarb.toml
pixelaw = { path = "../pixelaw/core/contracts" }
```
## 4. Maintenance
The idea is that you'll copy this template and create your own PixeLAW app with it. So eventually the versions of Core, Dojo may get outdated.

3. Modify version in `Scarb.toml` file in core repo
```Scarb.toml
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.1-alpha.11" }
```
### 4.1 Upgrade Dojo
To upgrade Dojo, you have to upgrade Pixelaw Core (see below)

4. Build and run core
```bash
cd contracts
sozo build
sozo migrate apply
```
### 4.2 Upgrade Core
The easiest is to do a full-text search/replace on the Core version number (for example `0.5.10`) and replace it with the new version. Then it's easiest to
1. Delete the `/target/` folder
1. Delete the `Scarb.lock` file
1. Full Rebuild using `sozo build`
1. Fix any compile issues
1. Run (integration) tests with `sozo test`
1. Fix any test issues
1. If applicable: Upgrade your live code using `sozo migrate --profile sepolia`
8 changes: 4 additions & 4 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ dependencies = [

[[package]]
name = "pixelaw"
version = "0.5.7"
source = "git+https://github.com/pixelaw/core?tag=v0.5.7#96260a5d1142e24eb30d63eb69ed47c036081376"
version = "0.5.10"
source = "git+https://github.com/pixelaw/core?tag=v0.5.10#96260a5d1142e24eb30d63eb69ed47c036081376"
dependencies = [
"dojo",
]

[[package]]
name = "pixelaw_test_helpers"
version = "0.5.7"
source = "git+https://github.com/pixelaw/core?tag=v0.5.7#96260a5d1142e24eb30d63eb69ed47c036081376"
version = "0.5.10"
source = "git+https://github.com/pixelaw/core?tag=v0.5.10#96260a5d1142e24eb30d63eb69ed47c036081376"
dependencies = [
"dojo",
"dojo_cairo_test",
Expand Down
4 changes: 2 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ version = "0.0.0"
sierra-replace-ids = true

[dependencies]
pixelaw = { git = "https://github.com/pixelaw/core", tag = "v0.5.7" }
pixelaw = { git = "https://github.com/pixelaw/core", tag = "v0.5.10" }
#pixelaw = { path = "../core/contracts" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.1" }

[dev-dependencies]
dojo_cairo_test = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.1" }
pixelaw_test_helpers = { git = "https://github.com/pixelaw/core", tag = "v0.5.7" }
pixelaw_test_helpers = { git = "https://github.com/pixelaw/core", tag = "v0.5.10" }
#pixelaw_test_helpers = { path = "../core/test_helpers" }

[[target.starknet-contract]]
Expand Down
5 changes: 3 additions & 2 deletions dojo_sepolia.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ mappings = {}
[env]
rpc_url = "https://starknet-sepolia.public.blastapi.io/rpc/v0_7"
keystore_path = "accounts/sepolia.deployer.keystore.json"
account_address = "0x00BAcDF8Ccd3AA527caB838E5Ea45e045dBb0E12E2da4434579DF99d9233253B"
world_address = "0x6f130c8e150882e39cbe878c650c8f35c86579180dbc77d0c1cbe169449b5f6"
world_address = "0x6f130c8e150882e39cbe878c650c8f35c86579180dbc77d0c1cbe169449b5f6"

account_address = "YOUR_ACCOUNT"
Loading

0 comments on commit cdf46a3

Please sign in to comment.