The source of truth for all facets related to the Spellcaster API suite of tools and game loops
Learn about Treasure »
Infrastructure
·
The Treasureverse
·
Request Feature
Simplifying blockchain interactions and allowing for seamless developer and user experiences is what makes Treasure magical. With this grimoire, harnesing the Spellcaster API to delight Treasure ecosystem players is as effortless as using a regular API.
By working on the secure, customizable, and user-centric blockchain features and bundling the blockchain interactions into a developer friendly API, Spellcaster frees up valuable developer time and resources to focus on making the best gaming experience for all Treasure players
IMPORTANT: Use Node version 18.x
- Install NodeJS. You can also install/manage NodeJS via nvm, which helps with managing multiple repos with varying versions needed
- Install Yarn, the package manager that is used to build and cache dependencies as well as the
solhint/spellcaster
solhint plugin nested locally - (Optional) Install act - Local GitHub Actions, a local GitHub Action runner, to ensure code stability before PRing. This will save from PRs that get flagged with errors. You will need to install Docker if you have not already
yarn init
To install Forge, go to https://book.getfoundry.sh/getting-started/installation
The following command gets ran via ci and will block code that doesn't conform.
yarn lint:check
Run the following command to try to automatically fix linting errors.
yarn lint:fix
yarn build
yarn test
When committing code, Husky will run 2 pre-commit hooks:
- commitlint - A conventional commit messaging enforcer. See https://www.conventionalcommits.org/en/v1.0.0/ for what conventional commits strive to achieve
- Lint / format fixing - Runs solhint + forge fmt to ensure code style formats are consistent across the repo. Will prevent commits if any errors are found
To run the lint-build-test
GitHub Action job, execute the following script:
./run-gh-actions.sh -j lint-build-test
This script will build and use the Dockerfile
as the local runner with Node/Rust/Yarn preinstalled to bypass those slow steps. It will also reuse the previous run state (build/eslint state, etc) to only track changes between runs. It will always full copy the repo file state for anything not in the .gitignore file.
NOTE1: This requires docker
and act
to be installed and will prompt if they are missing.
NOTE2: If there are any weird issues, reset your act setup by deleting the container that starts with act-spellcaster-facets
and optionally the $HOME/.cache/actcache
directory (the local cache server location for the actions/cache
package)
NOTE3: If you are running a Mac with an Apple Silicon CPU, some of the following settings should be considered for performance optimizations:
- Currently there is a crippling performance bug on Docker Desktop's latest version. If the
Virtual Machine Server
service is at max CPU usage, revert to version 4.14.1 for now. - Enable
VirtioFS
for optimal volume file sharing (in Beta Features for verion 4.14.1 and General for latest versions) - Disable
Open Docker Dashboard at startup
- Do NOT use
-b
when running therun-gh-actions.sh
script. Binding mounts for Mac Silicon is extremely slow.
For optimal intellisense and NatSpec completion, it is recommended to use the Nomic Foundation's Solidity extension, in addition to adding the following VSCode snippet (since there isn't any native event/struct completion snippets)
To add the snippet on Mac: Open Command Palette -> Type Snippet -> Press "Snippets: Configure User Snippets" -> find the 'Solidity' language -> Paste the following
{
"natspec event": {
"prefix": "\/\/ nat_event",
"body": "\/**\r\n * @notice \r\n * @param \r\n *\/",
"description": "natspec for events"
},
"natspec struct": {
"prefix": "\/\/ nat_struct",
"body": "\/**\r\n * @dev \r\n * @param \r\n *\/",
"description": "natspec for structs"
}
}
Now you can find these completions whenever typing '/'. For non-events/structs, use the default completion, as it will generate based on params and return variables
Treasure - @Treasure_DAO - [email protected]
Project Link: https://treasure.lol