- Make sure to use Node 16. NVM is your friend
yarnto install all packages and dependencies- Create
.envfile in./evmbased of./evm/.env.examplefor now, the mnemonic is the most important since this is local)
- run
yarn deployin./evmto deploy a local instanceYou should/could see an updated
./evm/deployments/localhostfolder - Create
.envfile in./appbased of./app/env.local.exampleUse addresses from
./evm/deployments/localhostin./app/.env - From root dir
./runyarn start
Yarn start triggers, in order:
- the smart contract test suite
- typechain to provide the front end with typings for Quiver
hardhat nodefrom./evm/instance for local evm chainyarn devfrom./appfor local frontend onlocalhost:3000
Connect you wallet to RPC http://localhost:8545/
Changes to front-end will be live, changes to smart-contract code require restart
- Create or change smart contracts in
./emv/contracts/ - Create or change test suites in
./evm/test/ - Run
yarn testfrom./evm/This will also create types for the app and abis for the Graph
- Create
./app/.env.localfrom./app/.env.local.template - Update
./app/hooks/ - Create or change pages (and components) in
./app/pages/
- Run
yarn startfrom./Runs smart contracts tests Generates types for app and ABIs for Graph Start local hardhat node (evm instance) Start front-end app
To interact with the app, connect your wallet to local RPC http://localhost:8485/
In case you need more complex data objects, or want to reduce multiple get calls to the contract to a single database query, or whatever, you can use the Graph. This package runs a local instance of the Graph where you can deploy to and call the endpoint via your app. It requires docker-compose.
-
Change and/or update
./graph/schema.graphqlDefine your entitites and relations
-
Change and/or update
./graph/subgraph.yaml.tsDefine the data sources
-
Change and/or update
./graph/mapping.tsDefine the data processing from events from source to entities and relations in schema
-
Run
yarn start:localfrom./graphCreate Docker-compose instance
-
Run
yarn create:localfrom./graph
Inspect your Graph on http://localhost:8000/subgraphs/name/summon/raid-app/graphql
For unit testing the Graph we use matchstick
If you're using the Graph open 2 terminals
-
Run
yarn startfrom./Inspect app on localhost:3000 Remember to connect your wallet to RPC localhost:8545
-
Run
yarn start:graphfrom./ -
When done, run
yarn stop:localfrom./graphto clean up docker instance. If you don't do this, blocks will get out of sync and the next run will crash.
Play around with the interaction. The second derived address in your wallet is the owner of the token as you can see under ERC20
- Mint some tokens
- Stake portion of those tokens
- Claim rewards
- Mint NFTs
- Play around
Cool bonus: when you create a stake, that is registered by the Graph and displayed in the 'Latest stakes' card under Staking
The used addresses for deployer, owner and user are configured in ./evm/hardhat.config.ts. For local testing different addresses are used to validate the ownership or role-based modifiers.
- Update or add deployment scripts in
./evm/deploy/ - Run
hardhat deployto validate the deployment - Run
yarn hardhat --network [NETWORK_NAME_HERE] deployUse a network configured in
./evm/hardhat.config.ts - Run
yarn hardhat --network [NETWORK_NAME_HERE] etherscan-verifyto verify the contracts on the relevant block explorer.
Check out Vercel
-[ ] Add in fleek.co deployment
- Create subgraph entry in Hosted Version Dashboard
- Update deploy script with subgraph name
- Run
yarn deployfrom./graph
APP
- NextJS
- Raid Guild Design System
EVM