Skip to content
Merged

V82 #62

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
cd47965
curve amo on base + erc20 state by day
apexearth Feb 17, 2025
7725bc1
fix resolver
apexearth Feb 17, 2025
1d1120e
upsert states by day
apexearth Feb 17, 2025
74087ab
fix ids
apexearth Feb 18, 2025
fd8a2e3
run postdeploy
apexearth Feb 18, 2025
6fb4916
fix chainid input
apexearth Feb 18, 2025
b409749
fix otoken erc20balance id
apexearth Feb 21, 2025
3966dbc
wip state by day
apexearth Feb 21, 2025
4fb8bcf
wip state by day
apexearth Feb 21, 2025
e14a45b
postdeploy for v80
apexearth Feb 22, 2025
3f69c85
wip pool booster
apexearth Feb 26, 2025
7cb6042
fix crash
apexearth Feb 26, 2025
bb51190
disable archive for base temporarily
apexearth Feb 26, 2025
f533740
Merge commit '7cb604228ce21ccd3903a168b640f57e4df455e3' into feat/poo…
apexearth Feb 26, 2025
deb9787
generic pool booster processing
apexearth Feb 26, 2025
2111cad
Add day key to coingecko data so day transitions won't return cached …
apexearth Feb 26, 2025
35d0208
add wOS erc20 tracking
apexearth Feb 27, 2025
2f2f897
perf debugging using v81
apexearth Feb 27, 2025
cfd1c51
updated squid-utils for dynamic block rates
apexearth Feb 28, 2025
2419387
enable perf debug
apexearth Feb 28, 2025
59550ee
log saved counts in otoken for debug
apexearth Feb 28, 2025
d23bf60
perf improvements - only update owners which have changed/been pulled…
apexearth Feb 28, 2025
f7c2195
remove logs
apexearth Feb 28, 2025
8f6428c
Merge commit 'd23bf60b9c7537a150d47912cf03459700215d59' into v81
apexearth Feb 28, 2025
5dd2905
wrap extra logging in DEBUG_PERF
apexearth Feb 28, 2025
85edff7
revert squid.yaml disable archive changes
apexearth Feb 28, 2025
4a42ff0
on rebase, make sure we mark the changed owners as changed.
apexearth Feb 28, 2025
9aa6f51
Merge branch 'v80' into v81
apexearth Feb 28, 2025
463d0b8
update readme, fix flag direction
apexearth Feb 28, 2025
aa79d81
fix
apexearth Feb 28, 2025
8f8d27b
Update processing times and entities
apexearth Feb 28, 2025
8241e98
wip
apexearth Mar 4, 2025
25df8d8
wip
apexearth Mar 5, 2025
f4055c9
wip
apexearth Mar 6, 2025
ae8b3c2
wip
apexearth Mar 7, 2025
8d07326
100% accuracy woop woop
apexearth Mar 8, 2025
e3cf1b6
sonic wip
apexearth Mar 8, 2025
ada6615
wip on storage aspect
apexearth Mar 8, 2025
968d245
wip on storage aspect
apexearth Mar 9, 2025
6785f12
wip on storage aspect
apexearth Mar 9, 2025
16ae6b5
wip on storage aspect, configure for sonic only
apexearth Mar 11, 2025
6467b61
wip on storage aspect, configure for sonic only
apexearth Mar 11, 2025
6cb0bd8
rename files, wip
apexearth Mar 11, 2025
5cb39c3
fixes
apexearth Mar 11, 2025
633c809
fixes
apexearth Mar 11, 2025
af68f1c
fix
apexearth Mar 11, 2025
78abba0
change yieldFrom and yieldTo to address only
apexearth Mar 11, 2025
b4aea2b
fix ousd start time
apexearth Mar 11, 2025
df7ae3d
fix rebasingSupply
apexearth Mar 11, 2025
7dc7e13
fix
apexearth Mar 11, 2025
55c5f16
fix
apexearth Mar 11, 2025
6b69c0d
add os validation entities for v80
apexearth Mar 11, 2025
4ae4e3d
turn off debug perf
apexearth Mar 11, 2025
631ef05
add safety on bigint json stringify/parse
apexearth Mar 11, 2025
a5805a4
debug
apexearth Mar 11, 2025
5cf02c0
persistence work and history yield
apexearth Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@

.env
.yarn.lock
.DS_Store
.DS_Store

*.txt
168 changes: 95 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,31 @@ BLOCK_FROM=18421105 sqd process:oeth # Start processing at block 18421105
BLOCK_TO=18421105 sqd process:oeth # Process up to block 18421105
```

## Frequent Commands
## Useful Commands

```shell
yarn codegen # Generate Schema code
sqd typegen # Generate ABI code
sqd down # Bring down squid container
sqd up # Bring up squid container
sqd process:oeth # Run OETH processor
sqd process:ousd # Run OUSD processor
sqd process:mainnet # Run misc processor
sqd migration:generate # Generate migration (sqd down && sqd up first)
# Code Generation
yarn generate # Generate new migration
yarn typegen # Generate ABI code

yarn setup # Reset database - run prior to starting processing for a fresh start

# Processing Commands
yarn process:arbitrum # Run Arbitrum processor
yarn process:base # Run Base processor
yarn process:sonic # Run Sonic processor
yarn process:oeth # Run OETH processor
yarn process:ousd # Run OUSD processor
yarn process:ogv # Run OGV processor
yarn process:mainnet # Run misc mainnet processor
yarn process:test # Run test processor
yarn process # Run combined processor

# Local GraphQL Server
yarn serve # You'll have to rebuild and rerun to see updates here.

# Deployment Tools
yarn postdeploy v81 # Run post-deployment tasks (processing times log and validations)
```

## Quickstart
Expand All @@ -47,99 +61,107 @@ sqd migration:generate # Generate migration (sqd down && sqd up first)
# 0. Install @subsquid/cli a.k.a. the sqd command globally
npm i -g @subsquid/cli

# 1. Retrieve the template
sqd init my_squid_name -t evm
cd my_squid_name

# 2. Install dependencies
# 1. Install dependencies
npm ci

# 3. Start a Postgres database container and detach
sqd up
# 2. Start a Postgres database container and setup
yarn setup

# 4. Build and start the processor
sqd process:oeth
# 3. Build and start the processor (choose one)
yarn process:oeth
yarn process:ousd
yarn process:mainnet
# ... or other available processors

# 5. The command above will block the terminal
# being busy with fetching the chain data,
# transforming and storing it in the target database.
#
# To start the graphql server open the separate terminal
# and run
sqd serve
# 4. In a separate terminal, start the GraphQL server
yarn serve
```

A GraphiQL playground will be available at [localhost:4350/graphql](http://localhost:4350/graphql).

## Dev flow

### 1. Define database schema
## Dev Flow

Start development by defining the schema of the target database via `schema.graphql`.
Schema definition consists of regular graphql type declarations annotated with custom directives.
Full description of `schema.graphql` dialect is available [here](https://docs.subsquid.io/basics/schema-file).
### 1. Make Schema Changes

### 2. Generate TypeORM classes
- Add or modify GraphQL schema files in `src/**/*.graphql`
- Run `yarn generate` to:
- Combine GraphQL files into schema.graphql
- Generate TypeORM entities
- Create new database migration
- Add new files to git

Mapping developers use TypeORM [EntityManager](https://typeorm.io/#/working-with-entity-manager)
to interact with target database during data processing. All necessary entity classes are
generated by the squid framework from `schema.graphql`. This is done by running `yarn codegen`
command.
### 2. Add New Events/Contracts

NOTE: We don't directly use the `sqd codegen` command because we generate our schema.graphql file first in
the `yarn codegen` script.
- Add ABI JSON files to `./abi/`
- Run `yarn typegen` to generate TypeScript interfaces
- Create new processor in `src/processors/` or add to existing one
- Update `squid.yaml` if adding new processor

### 3. Generate database migrations

All database changes are applied through migration files located at `db/migrations`.
`squid-typeorm-migration(1)` tool provides several commands to drive the process.
### 3. Local Development

```bash
## drop create the database
sqd down
sqd up
# Start fresh
yarn setup

# Run processor (choose one)
yarn process:oeth
yarn process:ousd
# ... etc

## replace any old schemas with a new one made from the entities
sqd migration:generate
# In another terminal
yarn serve
```

See [docs on database migrations](https://docs.subsquid.io/basics/db-migrations) for more details.
### 4. Testing Changes

### 4. Import ABI contract and generate interfaces to decode events
- Use GraphiQL playground at [localhost:4350/graphql](http://localhost:4350/graphql)
- Check processing times with `yarn log:processing-times`
- Validate data integrity with generated validation queries

It is necessary to import the respective ABI definition to decode EVM logs. One way to generate a type-safe facade class
to decode EVM logs is by placing the relevant JSON ABIs to `./abi`, then using `squid-evm-typegen(1)` via an `sqd`
script:
### 5. Deployment

#### Development (v999)

```bash
sqd typegen
# Reset dev environment (v999)
# Only use when you need to reset schema or reload data
sqd deploy . --update --hard-reset
```

See more details on the [`squid-evm-typegen` doc page](https://docs.subsquid.io/evm-indexing/squid-evm-typegen).
#### Production Deployment

## Project conventions
1. Create and push a new version branch

Squid tools assume a certain [project layout](https://docs.subsquid.io/basics/squid-structure):
```bash
git checkout -b v80 # Replace 80 with your version number
# Make any final changes if needed
git push origin v80
```

2. Wait for the deployment to complete and validate the data

3. Tag for production

```bash
# Once validated, tag the latest commit for production
git tag prod-v80 # Replace 80 with your version number
git push origin prod-v80
```

- All compiled js files must reside in `lib` and all TypeScript sources in `src`.
The layout of `lib` must reflect `src`.
- All TypeORM classes must be exported by `src/model/index.ts` (`lib/model` module).
- Database schema must be defined in `schema.graphql`.
- Database migrations must reside in `db/migrations` and must be plain js files.
- `sqd(1)` and `squid-*(1)` executables consult `.env` file for environment variables.
4. Monitor deployment

## Deploy a new version
- Check processing at https://app.subsquid.io/squids
- Follow release checklist at the top of this README
- Keep the version branch for reference, DO NOT DELETE

- Visit [Squid deploy dashboard](https://app.subsquid.io/squids/deploy)
- Auth with `sqd auth -k sqd_XXX` (key is on squid deploy page)
- Update `squid.yaml` to set the correct version
- Run `sqd deploy .`
- Make branch for new version (eg v9) and push to origin
- Switch back to main branch
Note: Local deployment via `sqd deploy .` is possible but not recommended for production releases.

## Reset cloud dev version (v999)
## Project conventions

Useful if you made a schema change or need to reload data.
Squid tools assume a certain [project layout](https://docs.subsquid.io/basics/squid-structure):

- Check `squid.yaml` to make sure you're on v999
- `sqd deploy . --update --hard-reset`
- All compiled js files must reside in `lib` and all TypeScript sources in `src`
- The layout of `lib` must reflect `src`
- All TypeORM classes must be exported by `src/model/index.ts`
- Database schema is generated from GraphQL files in `src`
- Database migrations must reside in `db/migrations` and must be plain js files
Loading