Docs at https://rainprotocol.github.io/foundry.template
forge init -t rainprotocol/foundry.template <projectname>
cd <projectname>
forge install foundry-rs/forge-std
Then update the readme, set the docs url and configure github pages on github repo settings.
For CI deployments, setup all the environment variables and define contracts to deploy in the matrix.
NOTICE The crates and tauri app are currently expecting a subgraph compatible with the schema in crates/subgraph/schema/orderbook.graphql
.
When this project is migrated to use the subgraph schema defined in subgraph/schema/graphql
, the command below will change.
- Run the following commands to generate Rust types from GraphQL Queries
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/vaultDetail.graphql > crates/subgraph/src/types/vault_detail.rs
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/vaultsList.graphql > crates/subgraph/src/types/vaults_list.rs
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/orderDetail.graphql > crates/subgraph/src/types/order_detail.rs
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/ordersList.graphql > crates/subgraph/src/types/orders_list.rs
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/vaultBalanceChangesList.graphql > crates/subgraph/src/types/vault_balance_changes_list.rs
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/orderTakesList.graphql > crates/subgraph/src/types/order_takes_list.rs
cynic querygen --schema crates/subgraph/schema/orderbook.graphql --query crates/subgraph/queries/orderTakeDetail.graphql > crates/subgraph/src/types/order_take_detail.rs
- Prepend each generated types file with the following:
use crate::schema;
use typeshare::typeshare;
- Add the following derives for all generated Rust types:
#[derive(Clone)]
- Add the following derives for all generated Rust types that also derive
cynic::QueryFragment
:
#[derive(Serialize)]
- Add the following macros to all generated Rust types
#[typeshare]
- Rename the conflicting enum
TokenVaultOrderBy::VaultId
toTokenVaultOrderBy::VaultId2
incrates/subgraphs/src/types/vaults.rs
Run the following from the repo root, outside the nix shell, to generate Typescript types from Rust types in crates/subgraph/src/types
.
nix run .#ob-tauri-prelude