Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap meet v2 #359

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Swap meet v2 #359

wants to merge 3 commits into from

Conversation

faces-of-eth
Copy link
Collaborator

@faces-of-eth faces-of-eth commented Feb 13, 2024

This PR delivers working updated code that satisfies all related criteria from the DIP-61 Swap Meet V2 Proposal

The code has been verified by DAO members / DOPE token holders to satisfy all criteria of that proposal, as early as November, 2023. I've held back the code and I'm only releasing it now because I feel its bug free, performant, and able to be handed off in a confident manner. Some of this required working directly with 3rd party teams, like Reservoir, to ensure functions such as cross-domain liquidity purchasing, or purchasing tokens in PAPER worked correctly.

All code here is running on a new, much more affordable hosting setup – away from Google Cloud / Vercel. It's now open to the public and can be verified at https://app.dopewars.gg

Let me state; This project has taken much longer than originally estimated and I want to express my sincere apologies for any inconvenience this may have caused to the community.

My joking manner and frustration with these circumstances have been taken out of context, and blown out of proportion by members of the DAO. I take responsibility for this, as I could have communicated in a more clear manner. However, as expressed multiple times through multiple channels my intention was never to cease working on the project completely. Due to unforeseen technical complexities and personal circumstances that arose during the course of the project, it required much more time to achieve the original goals. All things considered, my original estimates were off by a factor of at least 3x. Because of the time this project took to complete it's only right that I shoulder the burden and not request more than the original agreed upon rate.

For those members of the Dope Wars Community who have supported me through this time, I appreciate your patience and understanding as I tried working through these challenges. That said, while I might have broken some social contracts; no legal contract was broken to the DAO, and this proposal has now been fully satisfied.


A Path Forward

I'm reaching out to the DAO community directly here, as I've been removed from our main Discord channel. This action was taken after I defended myself against coercion and verbal attacks from several community members, both publicly and privately. Additionally, my opposition to a proposal, which I believe is not only financially imprudent but also technically unnecessary, contributed to my removal. This proposal involves paying $16K for a "code audit" on publicly available code—a task many have shown capability in handling without necessitating such expense. Moreover, the firm in question hasn't demonstrated a consistent ability to maintain similar code for Quixotic, despite having backing from former Quixotic engineers and the Optimism Foundation nearly two years ago.

After these events, conveniently the comments pointed my way with hostile intention have been removed while mine remain, and a narrative is being spun about this situation which is untrue.

It's come to my attention there is a belief within the DAO that it owns the domain name where this code is hosted. I want to clarify that the domain was purchased and registered by me, under the ownership of my company FACES OF ETH, alongside the conceptualization and development of the website, branding, formal processes, and visual identity in September of 2021.

There was never any agreement in place that the DAO would own the domain, my creative work, or that it was property of the DAO in any way shape or form. The only agreements that have been made were that the DAO would fund source code creation, and there was an implicit understanding that the code would then be uploaded back here, to Github which I'm doing now. My legal council also agrees with this stance, and I'm prepared to defend my right to this property if forced to.

My intentions have always aligned with the project's success and its community's best interests, and it continues to be, even after this misconception by members of the DAO, and hostile attacks by other members. Given the significant investment of time, resources, and creativity in bringing this project to life, coupled with the current strained relationship, I am contemplating continuing this arm of the project independently without backing of the DAO's treasury. There are still unfinished projects that I'm passionate about which I believe deserve to see the light of day, and other projects I believe the community would benefit from which members of the DAO have shut down repeatedly. Operating in an independent manner would give me the opportunity to explore these options without the burden of group-think and test the decentralized nature of the project.

However, I am open to discussing a fair resolution regarding the domain name, the NFT assets I purchased at a significant cost, and outstanding hosting costs that respects the contributions and interests of both parties.

What I will not do, is be forced out of the project, forced to "hand over" anything that is rightfully mine, or have false narratives crafted about my contributions to this project that don't reflect reality.

Saying all of this, I believe there is a path forward that can meet the needs of the DAO while acknowledging the financial and creative investments made. I am willing to engage in discussions to explore potential solutions, including transferring the domain name, provided we can reach an agreement on the reimbursement of the incurred costs and a fair consideration for the domain and NFT assets under my control.

If an agreement cannot be reached it's my intention to proceed at my own pace, releasing experiences that I believe would benefit the entire community – on Optimism – as an extension of my work that's been delivered here.


Changes Made

This work was completed over the course of the last year and contains massive changes to the Indexer, API Server, Job Server, and Web server to ensure everything is running the most modern software stack as possible, is error-free, observable, and fault tolerant. Time estimates have been placed here to the best of my memory, but the changes were so wide-ranging that they're only mostly correct.

  • Switch hosts from GCP to Railway to save money (6h)
    • api_server (from gcp)
    • job_server (from gcp)
    • indexer (from gcp)
    • web (from vercel)
  • Investigate + fix why indexer was breaking on Optimism (12h)
    • Implement more structured and better logging for observability
    • Upgrade from github.com/ethereum/go-ethereum v1.10.26 -> github.com/ethereum-optimism/op-geth v1.101305.0
  • Upgrade back-end Go code (24h)
    • (so that go generate ./... works again and we can update database fields)
    • Upgrade Go from 1.18 to 1.21 (2 years old)
    • Upgrade entgo.io/ent v0.11.6 -> v0.12.5 (2 years old)
    • Upgrade github.com/99designs/gqlgen v0.17.24 -> v0.17.43 (2 years old)
    • Fork / patch github.com/withtally/synceth v0.0.21 to fix breaking bugs (unmaintained)
  • Re-evaluate Indexer code and fix performance / attribution bugs (40-60h)
    • Parallelize all contract processing so it isn't dreadfully slow
    • Process transactions in sequence to maintain data integrity
    • Add database retry logic on transaction / deadlock fails
    • Use goroutines to parallelize fetching any information from Contract Storage
    • Ensure all upserts are idepotent
    • Reservoir: Write jobs to diff token ownership from API / Indexer
      • Double checks indexer is operating correctly.
  • Ensure indexer works for hustlers (6h)
    • (some owned by contract instead of wallet?)
    • Re-run indexer from scratch
    • Fix non-deterministic small bugs in indexer framework
    • Add stats endpoint for observability
  • Database Migrations + GraphQL API work (12h)
    • Ensure ID field can be queried as BigInt for numeric comparisons instead of string (to view only ogs)
    • Write updated resolver code for search so we can filter properly
    • Ensure bootstrap sql files still work with migrated fields
  • Ship server logs to Betterstack for observability (1h)
    • Implement custom HTTP POST in Logger
  • Reservoir: Implement BestTokenPrice sync script (2h)
    • Determine what data models to use from Reservoir
    • Create ENT fields
    • Test import script as grift
    • Turn into job from grift
    • Test / ensure reservoir sync works
  • Update marketplace "search" material view (12h)
    • Ensure all new fields are included in material view
    • Performance analyze the search index
    • Create background job to vacuum tables / save space
      • to reduce postgres hosting costs
    • Update search index material view to work with new reservoir data (6h)
      • Regenerate graphql on server
      • Regenerate graphql on client
      • Ensure pagination works
  • Refactor jobServer as job scheduler to run without http server (4h)
  • Schedule jobs for data integrity and maintenance
  • Provide endpoint to check latest job status
  • Create automated job to double-check token ownership from indexer (2h)
    • DOPE
    • Hustlers
    • [-] Gear (skipped b/c erc1155 has diff ownership model and items were found to be consistent)

Front End

  • Update Swap Meet UI (24h)
    • List sale price for DOPE
    • Display HUSTLERS from search_index
    • Hide naked hustlers
    • Display GEAR from search_index
    • Add filter bar for HUSTLERS
    • Add filter bar for GEAR
      • Adjust items.sql bootstrap data to UPPERCASE all types so filtering works
  • Update outdated frontend code to implement new features (24h)
    • Upgrade NextJS to 14
    • Upgrade react-query (2 years old) to tanstack/react-query
      • Migrate getNextPage params
      • Ensure infinite search and load still works
      • Ensure GraphQL generation still works on the frontend
    • Switch from useWeb3React to WAGMI (4h)
    • Test that all web3 interactions still work
    • Upgrade ethers from v5 to v6 to prevent RPC flooding issues
    • Fix numerous build errors from migrating to new Ent / TypeScript version
  • Fix random UI bugs (12h)
    • Hustler Configuration is slow because it's pulling RLEs
      from smart contract instead of database
    • Tune up gear equipment footer to be more solid, less buggy
    • Fix endless requests on hustler flex page (from component re-renders)
    • Ensure requp / removal works with ethers / wagmi upgrade
    • Perform on-chain check to ensure buy button checks gear claim status
      before purchases, in case the indexer / api are out of date
    • Figure out why vehicles aren't rendering for Hustler img
      after ethers / BigNumber updates
  • Implement Reservoir-Kit on the front-end (40h)
    • Ensure purchases can be made in PAPER, ETH, OP
      • Ensure cross-chain liquidity can be used for purchase
    • Work with Reservoir team to fix broken images on Optimism
    • Make a purchase
      • DOPE
      • Hustlers
      • Gear
    • Work around Blur tokens not being available (1h)
      • Don't show items from Blur as purchasable
      • Remove Blur items from api response
      • Work with reservoir team to ensure BLUR backend works (was broken)
    • List your items for sale (in multiple currencies)
      • DOPE
      • Hustler
      • Gear
  • Display all item prices in PAPER, with realtime feed
    • Implement Coingecko price API endpoint
      • Cache API requests so we don't hammer them and get banned
    • Implement React control / provider to fetch and convert
      prices
  • Add realtime check if DOPE gear claim status
    has changed since page load, and show alert
  • Re-implement One-click Hustler Mint
    • Check claim status on purchase
    • Make two-step process, purchase then mint hustler
    • Check DOPE ownership on hustlers/initiate
    • Run a test transaction

Code available and running on:
https://app.dopewars.gg

Below is a summary of the extensive changes as best as I could put them
together while working on this on and off over the course of the last
year.

[x] Switch hosts from GCP to Railway to save money **(4h)**
  [x] api_server (from gcp)
  [x] job_server (from gcp)
  [x] indexer (from gcp)
  [x] web (from vercel)
[x] Investigate + fix why indexer was breaking on Optimism **(6h)**
  [x] Implement more structured and better logging for observability
  [x] Upgrade from github.com/ethereum/go-ethereum v1.10.26 -> github.com/ethereum-optimism/op-geth v1.101305.0
[x] Upgrade back-end Go code **(24h)**
    ( so that `go generate ./...` works again and we can update database fields)
  [x] Upgrade Go from 1.18 to 1.21 (2 years old)
  [x] Upgrade entgo.io/ent v0.11.6 -> v0.12.5 (2 years old)
  [x] Upgrade github.com/99designs/gqlgen v0.17.24 -> v0.17.43 (2 years old)
  [x] Fork / patch github.com/withtally/synceth v0.0.21 to fix breaking bugs (unmaintained)
[x] Re-evaluate Indexer code and fix performance / attribution bugs **(40-60h)**
  [x] Parallelize all contract processing so it isn't dreadfully slow
  [x] Process transactions in sequence to maintain data integrity
  [x] Add database retry logic on transaction / deadlock fails
  [x] Use goroutines to parallelize fetching any information from Contract Storage
  [x] Ensure all upserts are idepotent
  [x] Reservoir: Write jobs to diff token ownership from API / Indexer
      Double checks indexer is operating correctly.
[x] Ensure indexer works for hustlers **(6h)**
    (some owned by contract instead of wallet?)
  [x] Re-run indexer from scratch
  [x] Fix non-deterministic small bugs in indexer framework
  [x] Add stats endpoint for observability
[x] Database Migrations + GraphQL API work **(6h)**
  [x] Ensure ID field can be queried as BigInt for numeric comparisons instead of string (to view only ogs)
  [x] Write updated resolver code for search so we can filter properly
  [x] Ensure bootstrap sql files still work with migrated fields
[x] Ship server logs to Betterstack for observability **(1h)**
  [x] Implement custom HTTP POST in Logger
[x] Reservoir: Implement BestTokenPrice sync script **(2h)**
  [x] Determine what data models to use from Reservoir
  [x] Create ENT fields
  [x] Test import script as grift
  [x] Turn into job from grift
  [x] Test / ensure reservoir sync works
[x] Update marketplace "search" material view **(12h)**
  [x] Ensure all new fields are included in material view
  [x] Performance analyze the search index
  [x] Create background job to vacuum tables / save space
      to reduce postgres hosting costs
  [x] Update search index material view to work with new reservoir data **(6h)**
    [x] Regenerate graphql on server
    [x] Regenerate graphql on client
    [x] Ensure pagination works
[x] Refactor jobServer as job scheduler to run without http server **(4h)**
    [x] Implement <https://github.com/bamzi/jobrunner>
  [x] Schedule jobs for data integrity and maintenance
  [x] Provide endpoint to check latest job status
[x] Create automated job to double-check token ownership from indexer **(2h)**
  [x] DOPE
  [x] Hustlers
  [-] Gear (to be implemented b/c erc1155 has diff ownership model)

[x] Update Swap Meet UI **(24h)**
  [x] List sale price for DOPE
  [x] Display HUSTLERS from search_index
  [x] Hide naked hustlers
  [x] Display GEAR from search_index
  [x] Add filter bar for HUSTLERS
  [x] Add filter bar for GEAR
    [x] Adjust items.sql boostrap data to UPPERCASE all types so filtering works
[x] Update outdated frontend code to implement new features **(24h)**
  [x] Upgrade NextJS to 14
  [x] Upgrade react-query (2 years old) to tanstack/react-query
    [x] Migrate getNextPage params
    [x] Ensure infinite search and load still works
    [x] Ensure graphQL generation still works on the frontend
  [x] Switch from useWeb3React to WAGMI (4h)
  [x] Test that all web3 interactions still work
  [x] Upgrade ethers from v5 to v6 to prevent RPC flooding issues
  [x] Fix numerous build errors from migrating to new Ent / Typescript version
[x] Fix random UI bugs **(12h)**
  [x] Hustler Configuration is slow because it's pulling RLEs
      from smart contract instead of database
  [x] Tune up gear equipment footer to be more solid, less buggy
  [x] Fix endless requests on hustler flex page (from component re-renders)
  [x] Ensure requp / emoval works with ethers / wagmi upgrade
  [x] Perform on-chain check to ensure buy button checks gear claim status
      before purchases, in case the indexer / api are out of date
  [x] Figure out why vehicles aren't rendering for Hustler img
      after ethers / bignumber updates
[x] Implement Reservoir-Kit on the front-end **(40h)**
  [x] Ensure purchases can be made in PAPER, ETH, OP
    [x] Ensure cross-chain liquidity can be used for purchase
  [x] Work with Reservoir team to fix broken images on Optimism
  [x] Make a purchase
    [x] DOPE
    [x] Hustlers
    [x] Gear
  [x] Work around Blur tokens not being available (1h)
    [x] Don't show items from Blur as purchasable
    [x] Remove Blur items from api response
    [x] Work with reservoir team to ensure BLUR backend works (was broken)
  [x] List your items for sale (in multiple currencies)
    [x] DOPE
    [x] Hustler
    [x] Gear
[x] Display all item prices in PAPER, with realtime feed
  [x] Implement Coingecko price api endpoint
      Cache API requests so we dont hammer them and get banned
  [x] Implement React control / provider to fetch and convert
      prices
[x] Add realtime check if DOPE gear claim status
    has changed since page load, and show alert
[x] Re-implement One-click Hustler Mint
  [x] Check claim status on purchase
  [x] Make two-step process, purchase then mint hustler
  [x] Check dope ownership on hustlers/initiate
  [x] Run a test transaction
Copy link
Contributor

@oscgu oscgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants