Desiege is a Massively PvP experience built on StarkNet.
This folder contains Desiege Game contracts. If you're looking for another contract, please see the directory of our Realms Smart Contracts.
Module | Function | Current Status |
---|---|---|
TowerDefence | The core Desiege contract | In review |
TowerDefenceStorage | Storage variables for Desiege | In review |
GridMovement | Checks movement logic | In review |
Elements | Users can mint Elements | In review |
🤔 What is the game?
Players select a team (Light or Dark) and need to coordinate to ensure a victory for their team.
Light players can cast a Shield spell and defend the city.
Dark players can cast an Attack spell and destroy the city.
🏗️ System architecture
- TODO: Add system architecture @micksabox
📦 Contract hierarchy
- TODO: Add contract hierarchy @micksabox
Initial Setup
Clone this repo and use our docker shell to interact with starknet:
git clone git@github.com:BibliothecaForAdventurers/realms-contracts.git
cd realms-contracts
scripts/shell starknet --version
The CLI allows you to deploy to StarkNet and read/write to contracts already deployed. The CLI communicates with a server that StarkNet runs, which bundles the requests, executes the program (contracts are Cairo programs), creates and aggregates validity proofs, then posts them to the Goerli Ethereum testnet. Learn more in the Cairo language and StarkNet docs here, which also has instructions for manual installation if you are not using docker.
Development Workflow
If you are using VSCode, we provide a development container with all required dependencies.
When opening VS Code, it should ask you to re-open the project in a container, if it finds
the .devcontainer folder. If not, you can open the Command Palette (cmd + shift + p
),
and run “Remote-Containers: Rebuild and Reopen in Container”.
Flow:
- Compile the contract with the CLI
- Test using pytest
- Deploy with CLI
- Interact using the CLI or the explorer
The compiler will check the integrity of the code locally. It will also produce an ABI, which is a mapping of the contract functions (used to interact with the contract).
Compile all contracts:
nile compile
Compile an individual contract:
nile compile contracts/desiege/01A_TowerDefence.cairo
Run all github actions tests: scripts/test
Run individual tests
scripts/shell pytest -s testing/l2/desiege/01_TowerDefence_test.py
- TODO: Add deploy instructions here @micksabox
Start up a local StarkNet devnet with:
nile node
Then run the deployment of all the contracts. This uses nile and handles passing addresses between the modules to create a permissions system.
scripts/deploy
Modules in progress
- TODO: Add Modules in progress here @micksaboxHow to Contribute
We encourage pull requests!
- Create an issue to describe the improvement you're making. Provide as much detail as possible in the beginning so the team understands your improvement.
- Fork the repo so you can make and test changes in your local repository.
- Test your changes Follow the procedures for testing in each contract sub-directory (e.g. /contracts/settling_game and make sure your tests (manual and/or automated) pass.
- Create a pull request and describe the changes you made. Include a reference to the Issue you created.
- Monitor and respond to comments made by the team around code standards and suggestions. Most pull requests will have some back and forth.
If you have further questions, visit #builders-chat in our discord and make sure to reference your issue number.
Thank you for taking the time to make our project better!
StarkNet is very new. Best practices are being discovered. We have amalgamated the best resources we think to guide you on your journey.
Guides & Docs
Discords to Join
The Realms Settling Game spans a number of repositories: