{"id":13759721,"url":"https://github.com/valorem-labs-inc/quay","last_synced_at":"2025-05-10T09:33:38.616Z","repository":{"id":37836435,"uuid":"503848808","full_name":"valorem-labs-inc/quay","owner":"valorem-labs-inc","description":"An open source, high performance limit order book for the Seaport smart contracts. Implemented in Rust using ethers-rs, this offers a turnkey option for digital asset marketplaces.","archived":false,"fork":false,"pushed_at":"2023-06-22T00:50:46.000Z","size":901,"stargazers_count":186,"open_issues_count":17,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-08T17:15:22.961Z","etag":null,"topics":["ethereum","nft","rust","seaport"],"latest_commit_sha":null,"homepage":"https://alcibiades.capital/blog/announcing-quay/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valorem-labs-inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-06-15T16:47:03.000Z","updated_at":"2024-07-16T15:28:44.000Z","dependencies_parsed_at":"2024-01-17T16:58:12.432Z","dependency_job_id":"a02b25dd-0a70-43e6-a805-271615a0ba70","html_url":"https://github.com/valorem-labs-inc/quay","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valorem-labs-inc%2Fquay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valorem-labs-inc%2Fquay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valorem-labs-inc%2Fquay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valorem-labs-inc%2Fquay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valorem-labs-inc","download_url":"https://codeload.github.com/valorem-labs-inc/quay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224941166,"owners_count":17395833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","nft","rust","seaport"],"created_at":"2024-08-03T13:00:58.229Z","updated_at":"2024-11-16T16:31:25.923Z","avatar_url":"https://github.com/valorem-labs-inc.png","language":"Rust","funding_links":[],"categories":["dApps directory","Rust"],"sub_categories":["NFT App Templates"],"readme":"# Quay\n\nQuay is an open source, high performance backend for the Seaport smart \ncontracts. The project is implemented in Rust, using Postgres as a storage\nbackend, with the aim of allowing a proliferation of signature based \ntrading platforms for ERC-721s and ERC-1155s based on the Seaport smart \ncontract interface.\n\n## Project structure\n\n### Web application\n\n`main.rs` contains the `main` function, which is called when the crate's\nbinary is executed. That in turn calls `startup.rs`. That creates the\napplication, attaches the services, routes, database connection pool, and\nrpc connection context used by the endpoints.\n\n### Routes/Services\n\nRoutes and services are defined in `/routes` using `actix-web` macros.\n\n### Telemetry\n\n`telemetry.rs` and `startup.rs` set up a tracing framework that provides rich\nlogs for runtime telemetry and development debugging. These tracing logs are\nthen extended via macros on routes.\n\nExample:\n\n```rust\n#[post(\"/offers\")]\n#[tracing::instrument(\nname = \"Adding a new offer\",\nskip(offer, pool, seaport),\nfields(\nofferer = %offer.parameters.offerer,\n)\n)]\nasync fn create_offer(\n    offer: web::Json\u003cOrder\u003e,\n    pool: web::Data\u003cPgPool\u003e,\n    seaport: web::Data\u003cSeaport\u003cProvider\u003cethers::providers::Http\u003e\u003e\u003e,\n) -\u003e HttpResponse {\n    if insert_offer(\u0026pool, \u0026offer, \u0026seaport).await.is_err() {\n        return HttpResponse::InternalServerError().finish();\n    }\n    HttpResponse::Ok().finish()\n}\n```\n\n### SIWE Authentication\n\nThis project supports EIP-4361 (Sign in with Ethereum) authentication. See \n`src/routes/sessions.rs` for implementation details.\n\n### Redis\n\nRedis is used for SIWE session storage. \n\n### Database\n\nThe database schema and queries are written in SQL and managed with `sqlx`. The\nschemas live in `migrations/`, and the database queries are inline where used\non the objects (SQL speaking objects). The database connection is handled in a\nconnection pool at application startup.\n\n#### Generating queries for macros\n\nWhen new queries are added, run `DATABASE_URL=postgres://postgres:password@localhost:5432/quay cargo sqlx prepare -- --lib`\nto generate new query definitions for the macro expansion used by sqlx.\n\n#### Migrations\n\nDatabase schema migrations are performed out of band with\n[sqlx-cli](https://crates.io/crates/sqlx-cli). All database migrations should be\ntested locally, and applied in a non-breaking fashion. What this means, ideally,\nis that there is a migration to add new functionality, then a rollout of the new\nbackend version, then another migration to delete any legacy schema after roll\nout.\n\n##### How to run migration using `sqlx-cli`\n1. `sqlx migrate add '\u003cMIGRATION_NAME\u003e'`;\n2. Write all necesarry queries in `migrations/\u003cMIGRATION_NAME\u003e`;\n3. Apply for local db (if it's required for testing): `sqlx migrate run`;\n\n### Smart contract interactions and data structures\n\nBlockchain interactions happen via RPC using the `ethers-rs` library. This project\ncontains type safe bindings for the seaport (`seaport.rs`) and conduit controller\n(`conduit_controller.rs`) contracts, which have been extended with other\nfunctionality, and will eventually include functions for serializing to and\nfrom postgres. The rpc connection is handled by a wrapped reference counter\nat application startup.\n\n### Local development environment\n\nDevelopers will need rust and docker to work on this project. Docker is used\nto host a local instance  of the postgres database to execute tests against.\nTo set up a local database, run: `./scripts/init_db.sh` and `./scripts/init_redis.sh`\n\n#### Building the project\n\nRun `cargo build` to build the project. `indexer.dockerfile` and `api.dockerfile` \nare useful for generating docker images for use in production or testing.\n\n### Tests\n\nTests live in the `/tests` folder.\n\n#### Running the tests\n\nRun `cargo test` any time after setting up your development environment.\n\n## CI/CD\n\nCI/CD is implemented using GitHub actions, the scripting is in\n`.github/workflows`. There are certain actions which run on open\npull requests, and deploy actions, which run only after passing\ntests on `master`.\n\n### Continuous Integration\n\nThis project uses `clippy`, `tarpaulin`, and a number of other crates\nto provide end-to-end tests, unit tests, formatting, linting, and static\nanalysis to enforce code quality. These tests are then run in an automated\nfashion using GitHub actions.\n\n### Continuous Deployment\n\nThis project supports deployment to Digital Ocean via `spec.yaml`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalorem-labs-inc%2Fquay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalorem-labs-inc%2Fquay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalorem-labs-inc%2Fquay/lists"}