diff --git a/README.md b/README.md index 9b37bda..2644b62 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # DApp Documentation + ## Requirements: -- Foundryup (https://book.getfoundry.sh/getting-started/installation) -- `.env.local` file correctly set with all required values from `.env.example` + +- Foundryup (https://book.getfoundry.sh/getting-started/installation) +- `.env.local` file correctly set with all required values from `.env.example` ## Installation @@ -19,29 +21,29 @@ yarn run dev ## Test contracts -``` +```bash forge test # Displays a summary of passing / failing tests ``` The default behavior for forge test is to only display a summary of passing and failing tests. You can control this behavior by increasing the verbosity (using the -v flag). Each level of verbosity adds more information: -- Level 2 (-vv): Logs emitted during tests are also displayed. That includes assertion errors from tests, showing information such as expected vs actual. -- Level 3 (-vvv): Stack traces for failing tests are also displayed. -- Level 4 (-vvvv): Stack traces for all tests are displayed, and setup traces for failing tests are displayed. -- Level 5 (-vvvvv): Stack traces and setup traces are always displayed. +- Level 2 (-vv): Logs emitted during tests are also displayed. That includes assertion errors from tests, showing information such as expected vs actual. +- Level 3 (-vvv): Stack traces for failing tests are also displayed. +- Level 4 (-vvvv): Stack traces for all tests are displayed, and setup traces for failing tests are displayed. +- Level 5 (-vvvvv): Stack traces and setup traces are always displayed. ## Deploy contracts First set your environment variables by creating `.env` file in `./forge` directory -``` +```bash cd forge source .env # source environment variables ``` ### Deploy unverified contract -``` +```bash forge create --rpc-url $RPC_URL \ --private-key $PRIVATE_KEY \ src/RubyRingV1.sol:RubyRingV1 @@ -51,7 +53,7 @@ Get an `RPC_URL` from a Node Provider, e.g [Alchemy](https://dashboard.alchemy.c ### Deploy verified contract -``` +```bash forge create --rpc-url $RPC_URL \ --private-key $PRIVATE_KEY \ --etherscan-api-key $ETHERSCAN_API_KEY \ @@ -65,7 +67,7 @@ Updated the `DEPLOYED_CONTRACT_ADDRESS` env variable with the contract address d ## Update fee destination addresses -``` +```bash cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \ "setFeeDestination(address)" \ --rpc-url $RPC_URL @@ -73,7 +75,7 @@ cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \ ## Update protocol fee percent -``` +```bash cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \ --rpc-url $RPC_URL "setProtocolFeePercent(uint256)" \ @@ -81,13 +83,13 @@ cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \ e.g., -``` -cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY --rpc-url $RPC_URL "setProtocolFeePercent(uint256)" 50000000000000000 # 0.05% +```bash +cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY --rpc-url $RPC_URL "setProtocolFeePercent(uint256)" 50000000000000000 # 0.05% ``` ## Update subject fee percent -``` +```bash cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \ "setSubjectFeePercent(uint256)" \ --rpc-url $RPC_URL @@ -95,15 +97,15 @@ cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \ e.g., -``` -cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY --rpc-url $RPC_URL "setSubjectFeePercent(uint256)" 50000000000000000 # 0.05% +```bash +cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY --rpc-url $RPC_URL "setSubjectFeePercent(uint256)" 50000000000000000 # 0.05% ``` ## Contract calls #### Example: getBuyPrice() -``` +```bash cast call $DEPLOYED_CONTRACT_ADDRESS "getBuyPrice(address, uint256)" \ \ --rpc-url $RPC_URL @@ -111,13 +113,13 @@ cast call $DEPLOYED_CONTRACT_ADDRESS "getBuyPrice(address, uint256)" \ e.g., -``` +```bash cast call $DEPLOYED_CONTRACT_ADDRESS "getBuyPrice(address, uint256)" 0xFd7f2FD12c04De6959FBA1cF53bDfC1A608E3377 2 --rpc-url $RPC_URL ``` #### Example: gemsBalance() -``` +```bash cast call $DEPLOYED_CONTRACT_ADDRESS "gemsBalance(address, address)" \ \ --rpc-url $RPC_URL @@ -125,37 +127,46 @@ cast call $DEPLOYED_CONTRACT_ADDRESS "gemsBalance(address, address)" \ e.g., -``` +```bash cast call $DEPLOYED_CONTRACT_ADDRESS "gemsBalance(address, address)" 0x05789ff70a29041fbe618ed0d0674e2b3998df1f 0x05789ff70a29041fbe618ed0d0674e2b3998df1f --rpc-url $RPC_URL ``` -# Backend Documentation -## Requirements +## Backend Documentation + +### Running via docker + +`docker compose up -d` + +### Running on your machine + +#### Requirements + - MongoDB (https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/) - Python 3 - Pip 3 -## Installation -``` +#### Installation + +```python cd backend source venv/bin/activate source .env - -pip install -r requirements.txt + +pip install -r requirements.txt ``` -## Cool to have +#### Run the app + +`sh ./scripts/run.sh` + +### Cool to have + - MongoDB Compass GUI (Handy GUI for the mongodb database) -## Running the Backend -``` -sh ./scripts/run.sh -``` +### API Docs OpenAPI -## API Docs OpenAPI After running the backend head to `http://127.0.0.1:8000/docs` -## Tests -``` -python -m pytest test -``` \ No newline at end of file +### Tests + +`python -m pytest test`