Part of https://www.notion.so/Implement-stacks-1b5a6b22d472806a82f5dafed6955138 Reviewed-on: #2 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2.5 KiB
Generate Azimuth Watchers
-
Clone the original Azimuth repo for required contracts:
git clone git@github.com:urbit/azimuth.git # Install dependencies npm install # Contracts are located in the contracts folder
-
Setup
cerc-io/watcher-ts
repo:git clone git@github.com:cerc-io/watcher-ts.git # Install dependencies and build packages yarn install && yarn build
-
Create a folder to place all the generated watchers in:
mkdir -p azimuth-watcher-ts/packages
-
In
watcher-ts/packages/codegen
, create aconfig.yaml
file with required codegen config for generating the watcher for a contractFor example, for
Azimuth
contract:# Contracts to watch (required). contracts: # Contract name. - name: Azimuth # Contract file path or an url. path: /home/user/azimuth/contracts/Azimuth.sol # Contract kind kind: Azimuth # Output folder path (logs output using `stdout` if not provided). outputFolder: /home/user/azimuth-watcher-ts/packages/azimuth-watcher # Code generation mode [eth_call | storage | all | none] (default: none). mode: eth_call # Kind of watcher [lazy | active] (default: active). kind: active # Watcher server port (default: 3008). port: 3001 # Solc version to use (optional) # If not defined, uses solc version listed in dependencies solc: v0.4.24+commit.e67f0147 # Flatten the input contract file(s) [true | false] (default: true). flatten: true
Note: Create
.sol
files with the contract code from Etherscan forConditionalStarRelease
,DelegatedSending
,Ecliptic
andLinearStarRelease
contracts and use the file path forcontracts.path
-
Run codegen command to generate the watcher:
# In watcher-ts/packages/codegen yarn codegen --config-file ./config.yaml
-
Update
contracts
,outputFolder
andport
fields in the config and re-run the codegen command for all other contracts -
Setup the parent folder
/home/user/azimuth-watcher-ts
where all the generated watchers are placed as a monorepo -
The gateway GQL server can be used to proxy queries to their respective watchers