|
1 | 1 | # Dojo core library. |
2 | 2 |
|
3 | | -This repository contains the contracts and associated tooling for Dojo. |
4 | | - |
5 | | -It includes the following crates: |
6 | | - |
7 | | -* `contracts`: the core contracts and logic for Dojo written in Cairo. |
8 | | -* `types`: the Rust types related to the core contracts. |
9 | | -* `compiler`: the Cairo compiler plugin for Dojo that generates the artifacts for the contracts and associated dojo manifests. |
10 | | - |
11 | | -Some binaries are also included: |
12 | | - |
13 | | -* `abigen`: a program that generates the Rust bindings for the contracts, which are written into the `types` crate. |
14 | | -* `demo-compiler`: a demo compiler that can `build`, `test` and `clean` a Dojo project. |
15 | | - |
16 | | -## Use the demo compiler. |
17 | | - |
18 | | -To not have to work with sozo, the demo compiler can be used to compile the contracts. |
19 | | -The primary goal of the demo compiler is to compile and test the dojo core contracts. |
20 | | - |
21 | | -```bash |
22 | | -cargo run -r -p demo-compiler build --manifest-path crates/contracts/Scarb.toml |
23 | | -cargo run -r -p demo-compiler test --manifest-path crates/contracts/Scarb.toml |
24 | | -cargo run -r -p demo-compiler clean --manifest-path crates/contracts/Scarb.toml |
25 | | -``` |
26 | | - |
27 | | -You can also compiles the examples by using the demo compiler, adjusting the path to the example `Scarb.toml` file. |
28 | | - |
29 | | -To expand the code generated by the plugin, you can set `DOJO_EXPAND=1`. |
30 | | - |
31 | | -## Abigen |
32 | | - |
33 | | -Using [cainome](https://github.com/cartridge-gg/cainome) to generate the bindings from the Cairo ABI, the bindings must be maintained up to date with the contracts. |
34 | | - |
35 | | -```bash |
36 | | -# Note, use `-r` to run the binary in release mode as Scarb is very slow in debug mode. |
37 | | - |
38 | | -# To generate the bindings. |
39 | | -cargo run -r -p dojo-abigen |
40 | | - |
41 | | -# To check if the bindings are up to date. |
42 | | -cargo run -r -p dojo-abigen -- --check |
43 | | -``` |
44 | | - |
45 | | -At the moment, after running the abigen, you must run the `cargo fmt` to fix the formatting of the generated bindings. |
46 | | -Please use the following script to format the code: |
47 | | -```bash |
48 | | -./scripts/rust_fmt.sh |
49 | | -``` |
50 | | - |
51 | | -## Examples |
52 | | - |
53 | | -The examples folders are here to test the compiler support and showcase the features. |
54 | | - |
55 | | -* `dojo_simple`: showcase a simple dojo project without any external dependencies. |
56 | | -* `workspace`: showcase a dojo project with multiple crates. |
57 | | - |
58 | | -## Contributing |
59 | | - |
60 | | -When working on `dojo-core`, consider the following: |
61 | | - |
62 | | -### Devcontainer |
63 | | -You can use the dev-container available on [github](https://github.com/dojoengine/dojo-core/pkgs/container/dojo-core-dev) to avoid installing all the dependencies locally. |
64 | | - |
65 | | -The devcontainer is also used in the CI pipeline. The devcontainer is built with `bookworm` as the base image, which should also work on Apple Silicon. |
66 | | - |
67 | | -You can re-build locally if necessary on a Apple Silicon machine using: |
68 | | -```bash |
69 | | -cd .devcontainer |
70 | | -sudo docker build --build-arg VARIANT=bookworm . |
71 | | -``` |
72 | | - |
73 | | -### Modifying rust code |
74 | | -When rust code is modified, please ensure you're formatting the code correctly running those scripts: |
75 | | -```bash |
76 | | -./scripts/rust_fmt.sh |
77 | | -./scripts/clippy.sh |
78 | | -./scripts/docs.sh |
79 | | -``` |
80 | | - |
81 | | -### Modifying Cairo code |
82 | | - |
83 | | -When Cairo code is modified, please ensure you're formatting: |
84 | | -```bash |
85 | | -./scripts/cairo_fmt.sh |
86 | | -``` |
87 | | - |
88 | | -If you have changed the Cairo code, you will want to run the test script to fix the Cairo changes into the test. **Please VERIFY the changes when running with --fix.** |
89 | | - |
90 | | -```bash |
91 | | -# PLEASE VERIFY THE GENERATED CODE IS CORRECT |
92 | | -./scripts/tests.sh --fix |
93 | | -``` |
94 | | - |
95 | | -### Testing |
96 | | - |
97 | | -To run the test suite that is used in the CI pipeline, you can run the following script: |
98 | | -```bash |
99 | | -./scripts/tests.sh |
100 | | -``` |
| 3 | +This repository has been archived since the core of Dojo is now back in the [main dojo repository](https://github.com/dojoengine/dojo/tree/main/crates/dojo/core). |
0 commit comments