- Foundryup (https://book.getfoundry.sh/getting-started/installation)
.env.localfile correctly set with all required values from.env.example
yarn install
yarn run dev
forge test # Displays a summary of passing / failing testsThe 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.
First set your environment variables by creating .env file in ./forge directory
cd forge
source .env # source environment variablesforge create --rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
src/RubyRingV1.sol:RubyRingV1Get an RPC_URL from a Node Provider, e.g Alchemy
forge create --rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--etherscan-api-key $ETHERSCAN_API_KEY \
--verify \
src/RubyRingV1.sol:RubyRingV1Interact with deployed contract using CAST
Updated the DEPLOYED_CONTRACT_ADDRESS env variable with the contract address deployed previously
cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \
"setFeeDestination(address)" <ADDRESS_FOR_FEE_DESTINATION> \
--rpc-url $RPC_URLcast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \
--rpc-url $RPC_URL
"setProtocolFeePercent(uint256)" <FEE_PERCENT_IN_WEI> \e.g.,
cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY --rpc-url $RPC_URL "setProtocolFeePercent(uint256)" 50000000000000000 # 0.05%cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY \
"setSubjectFeePercent(uint256)" <FEE_PERCENT_IN_WEI> \
--rpc-url $RPC_URLe.g.,
cast send $DEPLOYED_CONTRACT_ADDRESS --private-key $PRIVATE_KEY --rpc-url $RPC_URL "setSubjectFeePercent(uint256)" 50000000000000000 # 0.05%cast call $DEPLOYED_CONTRACT_ADDRESS "getBuyPrice(address, uint256)" \
<GEM_SUBJECT_ADDRESS> <AMOUNT_TO_BUY> \
--rpc-url $RPC_URLe.g.,
cast call $DEPLOYED_CONTRACT_ADDRESS "getBuyPrice(address, uint256)" 0xFd7f2FD12c04De6959FBA1cF53bDfC1A608E3377 2 --rpc-url $RPC_URLcast call $DEPLOYED_CONTRACT_ADDRESS "gemsBalance(address, address)" \
<GEM_SUBJECT_ADDRESS> <USER_ADDRESS> \
--rpc-url $RPC_URLe.g.,
cast call $DEPLOYED_CONTRACT_ADDRESS "gemsBalance(address, address)" 0x05789ff70a29041fbe618ed0d0674e2b3998df1f 0x05789ff70a29041fbe618ed0d0674e2b3998df1f --rpc-url $RPC_URLdocker compose up -d
- MongoDB (https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/)
- Python 3
- Pip 3
cd backend
source venv/bin/activate
source .env
pip install -r requirements.txtsh ./scripts/run.sh
- MongoDB Compass GUI (Handy GUI for the mongodb database)
After running the backend head to http://127.0.0.1:8000/docs
python -m pytest test