Skip to content

illustspace/gsr

Repository files navigation

gsr-contracts

Monorepo for the GeoSpatialRegistry

This repo contains the GeoSpatialRegistry smart contract, a TypeScript SDK for more easily working with it, and the indexer server for checking ownership of placements.

Packages

See each packages's README for details on usage and development.

@geospatialregistry/contracts

The smart contracts hardhat package can be found in packages/contracts, and the contracts themselves in packages/contracts/contracts

See packages/contracts/docs for a full walk-through of the smart contract logic.

@geospatialregistry/sdk

The TypeScript SDK can be found in packages/sdk.

@geospatialregistry/indexer

The indexer service can be found in packages/indexer

Dev environment setup

CockroachDB

First, install CockroachDb.

# linux/wsl
curl https://binaries.cockroachdb.com/cockroach-v22.1.11.linux-amd64.tgz | tar -xz && sudo cp -i cockroach-v22.1.11.linux-amd64/cockroach /usr/local/bin/
# macos
brew install cockroachdb/tap/cockroach

Or follow the docs for more details.

Dependencies

Then install dependencies:

# Set up corepack for yarn2
npm i -g corepack
# Install dependencies
yarn install

Build all packages:

yarn build

Tests

Unit Tests

Run all unit tests

yarn test

E2E Tests

Run E2E tests of the contracts, SDK, and indexer APIs

# Start a local blockchain
yarn ws contracts start
# Build the SDK
yarn ws sdk start
# Start up the test DB, and serve a text indexer on localhost:3001
yarn ws indexer e2e
# Run e2e tests
yarn ws e2e e2e:test

DB Setup

If you haven't run the server before, first deploy migrations

yarn ws indexer db:start # start the local db, if it is not already running.
yarn ws indexer db:deploy # deploy migrations to local db

Then, end the db:start process. If you don't, yarn start will try to restart the DB and will fail.

Dev Server

Make sure to run the DB setup before continuing.

For development, you can either start a local blockchain and all services in one command:

yarn start

Or start each one individually

# local blockchain
yarn ws contracts start
# SDK builder
yarn ws sdk start
# Indexer
yarn ws indexer start

Deployment

Github actions will run tests in CI when a commit goes up to a branch

Commits to develop will deploy to the testnet site

Commits to main will deploy to the mainnet site.

About

GeoSpatialRegistry

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors