Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Feat ] Cleanup and improves #73

Merged
merged 15 commits into from
Sep 23, 2024
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ web/public/assets/placeholder/pixel-state.png
**/**/*.log
**/**/*.sqlite
contracts/out
contracts/manifests
contracts/target
.aider*
db/
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# PixeLAW Core
![PixeLAW](https://pixelaw.github.io/book/images/PixeLAW.jpeg)

[![ci-contracts](https://github.com/pixelaw/core/actions/workflows/ci-contracts.yml/badge.svg)](https://github.com/pixelaw/core/actions/workflows/ci-contracts.yml)
<a href="https://x.com/0xpixelaw">
<img src="https://img.shields.io/twitter/follow/0xpixelaw?style=social"/>
</a>
<a href="https://github.com/pixelaw/core">
<img src="https://img.shields.io/github/stars/pixelaw/core?style=social"/>
</a>
[![discord](https://img.shields.io/badge/join-PixeLAW-green?logo=discord&logoColor=white)](https://t.co/jKDjNbFdZ5)


A game built on top of Dojo. See live example at <SECRET_URL: please reach out us on discord>.

This repository includes core components and systems. For more details, please check [PixeLAW Book](https://pixelaw.github.io/book/index.html).
Expand Down
43 changes: 43 additions & 0 deletions contracts/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Katana",
"type": "shell",
"command": "katana --disable-fee --allowed-origins '*' --db-dir db/katana",
"isBackground": true,
"problemMatcher": [],
"presentation": {
"panel": "dedicated",
"showReuseMessage": false,
"clear": false
}
},
{
"label": "Start Torii",
"type": "shell",
"command": "torii --world 0x263ae44e5414519a5c5a135cccaf3d9d7ee196d37e8de47a178da91f3de9b34 --database db/torii --allowed-origins '*'",
"isBackground": true,
"problemMatcher": [],
"presentation": {
"panel": "dedicated",
"showReuseMessage": false,
"clear": false
}
},
{
"label": "Start Katana and Torii",
"dependsOrder": "parallel",
"dependsOn": ["Start Katana", "Start Torii"],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "shared",
"showReuseMessage": false,
"clear": false
}
}
]
}
94 changes: 66 additions & 28 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# PixeLAW Contracts
# Pixelaw Contracts

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.

## Development

### Prerequisites
## Prerequisites

- [asdf](https://asdf-vm.com/)
- [scarb](https://docs.swmansion.com/scarb/)
Expand All @@ -25,10 +23,72 @@ asdf install dojo 1.0.0-alpha.11

```
asdf plugin add scarb
asdf install scarb 2.7.0-rc.4
asdf install scarb 2.7.0
```

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

## Running Locally

**If you use vscode,**

#### 1. Run the katana and torii
just open this repo and press `⌘` + `⇧` + `B`

#### 2. Migrate contracts

```bash
sozo build --manifest-path Scarb_deploy.toml
sozo migrate apply --manifest-path Scarb_deploy.toml
scarb --manifest-path Scarb_deploy.toml run init_auth
```

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

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

```bash
# Run Katana
katana --disable-fee --allowed-origins "*" --db-dir db/katana
```

#### 2. Terminal two

```bash
# Build the example
sozo build

# Migrate the example
sozo migrate apply

# Initialize the pixelaw app
scarb run init

# Start Torii
torii --world 0x263ae44e5414519a5c5a135cccaf3d9d7ee196d37e8de47a178da91f3de9b34 --allowed-origins "*" --database db/torii
```

## How to Deploy to Starknet

### Sepolia

1. Build

```zsh
sozo build --manifest-path Scarb_deploy.toml --profile sepolia
```

2. Migrate

```zsh
sozo migrate plan --account-address $YOUR_ACCOUNT_ADDRESS --private-key $YOUR_PRIVATE_KEY --profile sepolia --manifest-path Scarb_deploy.toml
```

3. Deploy

```zsh
sozo migrate apply --account-address $YOUR_ACCOUNT_ADDRESS --private-key $YOUR_PRIVATE_KEY --profile sepolia --manifest-path Scarb_deploy.toml
```

## Default Apps

Expand Down Expand Up @@ -127,25 +187,3 @@ The App is also tracking score for each Player.
- UI then calls the functions with only the hash value
- Reveal
- there will be 2 params: "rv_NAME" (the actual param) and "rs_NAME" (the used salt)

## How to Deploy to Starknet

### Sepolia

1. Build

```zsh
sozo build --manifest-path Scarb_deploy.toml --profile sepolia
```

2. Migrate

```zsh
sozo migrate plan --account-address $YOUR_ACCOUNT_ADDRESS --private-key $YOUR_PRIVATE_KEY --profile sepolia --manifest-path Scarb_deploy.toml
```

3. Deploy

```zsh
sozo migrate apply --account-address $YOUR_ACCOUNT_ADDRESS --private-key $YOUR_PRIVATE_KEY --profile sepolia --manifest-path Scarb_deploy.toml
```
9 changes: 6 additions & 3 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ sierra-replace-ids = true
[dependencies]
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.11" }

[lib]
[tool.fmt]
sort-module-level-items = true

# [lib]
[[target.dojo]]


[profile.dev-pop]

[profile.slot]

[scripts]
init_auth = "./scripts/init_auth.sh"
[profile.sepolia]
11 changes: 10 additions & 1 deletion contracts/Scarb_deploy.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
cairo-version = "=2.7.0"
name = "pixelaw"
version = "0.3.40"
version = "0.3.50"
homepage = "https://github.com/pixelaw/core"
edition = "2024_07"

Expand All @@ -11,6 +11,9 @@ sierra-replace-ids = true
[dependencies]
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.11" }

[tool.fmt]
sort-module-level-items = true

[[target.dojo]]
build-external-contracts = []

Expand All @@ -19,3 +22,9 @@ build-external-contracts = []
[profile.slot]

[profile.sepolia]

[scripts]
init = "./scripts/init.sh"
paint = "./scripts/paint.sh"
paint_json = "./scripts/paint_json.sh"
populate = "./scripts/populate.sh"
6 changes: 3 additions & 3 deletions contracts/dojo_slot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ mappings = {}

[env]
rpc_url = "https://api.cartridge.gg/x/pixelaw-dev/katana/"
account_address = "0x5233cfca86bfa18af0bdef2fd09ac4c1d7c8da71303eb7fc9997fc6d0914d0d"
private_key = "0xf0e37335d0c020789dd02c0460d99637ac23bd2df3d1d25002fd15621542d"
world_address = "0x99b8dbc71926673405f5dfff9e4900ee4d9249798cc5e7ac6f3c3a07907399"
account_address = "0x75aab901b406698604a33f1c81c6487b8de3b2d7ad2456cf01658b68b12aa5"
private_key = "0x74825107c10098a1a991b1419e0afad3afc9e9ba4d16dec23995916cdca4366"
world_address = "0x263ae44e5414519a5c5a135cccaf3d9d7ee196d37e8de47a178da91f3de9b34"
Loading
Loading