KlimaDAO / klimadao

Monorepo for the official KlimaDAO site, dApp, components and design system.
https://klimadao.finance
MIT License
92 stars 74 forks source link

[webhook] change useWeb3 hook address in `SellerConnected` to lowercase #2264

Closed psparacino closed 7 months ago

psparacino commented 7 months ago

Description

The useWeb3 hook is returning a checksum address while the subgraph returns only lowercase addresses.

This is causing a mismatch in several areas where hooks are not returning the correct listings, which leads to allowance errors etc.

For ex in the useGetUserswalletorhandle hook the useWeb3 hook is returning a checksum address while the subgraph is returning a lowercase address.

The hook checks if two addresses are strictly equal to determine whether to return expired listing or not. Therefore it returns only current listings, as the user isn't recognized as the listing owner.

This is a cascading issue, as those listings are also used to determine the correct allowance. Because only current listing are returned the user can actually lower their allowance below what the contract requires (all listings including expired as well as pending listing) as the expired listing amounts are not taken into account.

There should either be consistency to checksum or lowercase. Given the subgraph only uses lowercase it would probably be easier to use lowercase as the consistent format and then convert to checksum if ever required.

Related Ticket

Closes #2243

How to Test

  1. Check profile for expired listings
  2. Create a new listing. Allowance should be all listings, expired and current, plus new listing
vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
carbonmark ✅ Ready (Inspect) Visit Preview Feb 14, 2024 6:22pm
carbonmark-api ✅ Ready (Inspect) Visit Preview Feb 14, 2024 6:22pm
demo-integration ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2024 6:22pm
klimadao-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2024 6:22pm
1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **carbon** | ⬜️ Ignored ([Inspect](https://vercel.com/klimadao/carbon/7boVzQ32BLQVGMmmfgCB2tg7NmAH)) | [Visit Preview](https://carbon-git-tufnel-useweb3-hook-returns-lowercas-b40750-klimadao.vercel.app) | | Feb 14, 2024 6:22pm |