To build and run the service using Docker, follow these steps:
Navigate to the root directory of your repository.
Build the Docker image:
docker build /Users/{your username}/path/to/repo -t watch-tower-armoryReplace
{your username}andpath/to/repowith your actual username and the path to your repository.Run the Docker container:
docker run --env-file .env watch-tower-armory bash
This will run the container and execute the
bashshell, using the environment variables specified in your.envfile.
To test the service locally, you can simply run the backfill.sh script:
sh backfill.shCreate a .env file in the root directory of your project and populate it with the following keys:
# RPC URL for the blockchain network you're connecting to
FORK_URL={your rpc url here}
# Your Etherscan API key for interacting with Etherscan's API
ETHERSCAN_API_KEY={your etherscan api key}
# Address for the Watchtower contract
WTCHTWR_ADDRESS=0x731CB243C91FF16e96C24DCcB7aC6Ddf2C57222b
# Supabase URL for your project
SUPABASE_URL=https://{your link here}.supabase.co
# Supabase anonymous key
SUPABASE_ANON_KEY={your anon key here}
# Supabase login email
SUPABASE_EMAIL={your supabase login email}
# Supabase login password
SUPABASE_PASSWORD={your supabase login password}
# Anvil URL for your local setup (needs to be anvil as anvil only rpc commands are used)
ANVIL_URL=http://127.0.0.1:8545To add more contracts and their corresponding ABIs, you can extend the contracts array in your Wagmi configuration file. Here's how you can do it:
Import the ABI of the contract you want to add. You can either import it from a file or fetch it dynamically.
import{YourContractAbi}from'./path/to/YourContractAbi';// OR dynamically fetch ABIasyncfunctionfetchABI(address: string){// Your fetch logic here}
Add a new object to the
contractsarray in your Wagmi configuration:contracts: [{name: 'erc20',abi: erc20ABI,},{name: 'WtchTwr',abi: WtchTwrAbi,address: process.env.WTCHTWR_ADDRESS,},{name: 'YourContract',abi: YourContractAbi,address: 'YourContractAddressHere',}]
Make sure to replace
'YourContract'with the name you want to use for the contract, and'YourContractAddressHere'with the actual contract address.If you're fetching the ABI dynamically, you can use async functions to populate the
abifield:constyourDynamicABI=awaitfetchABI('YourContractAddressHere');
Save the configuration file and run your Wagmi CLI commands as usual.
By following these steps, you can easily extend your Wagmi configuration to include additional contracts and ABIs.