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

add swap and fix donate #72

Merged
merged 21 commits into from
Jan 9, 2024
Merged

add swap and fix donate #72

merged 21 commits into from
Jan 9, 2024

Conversation

krisbitney
Copy link
Contributor

@krisbitney krisbitney commented Dec 30, 2023

This PR adds swap functionality through Uniswap and fixes donations.

Please test donations to make sure they are working as expected!

@krisbitney krisbitney changed the base branch from web3Integrations to kris/realtime-donation-flow December 30, 2023 12:12
@krisbitney krisbitney requested review from L03TJ3 and sirpy December 30, 2023 12:13
packages/app/src/hooks/useApproveSwapTokenCallback.ts Outdated Show resolved Hide resolved
};

export const tokenMapping: SupportedTokens = {
export const tokenMapping: Record<string, `0x${string}`> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

token list is now used

packages/app/src/hooks/useFlowingBalance.tsx Show resolved Hide resolved
…o kris/integrate-swap

# Conflicts:
#	packages/app/src/components/ViewCollective.tsx
#	packages/app/src/components/WalletDetails/BothWalletDetails.tsx
#	packages/app/src/components/WalletDetails/DonorWalletDetails.tsx
#	packages/app/src/hooks/useFlowingBalance.tsx
@krisbitney
Copy link
Contributor Author

@sirpy You mentioned in the other PR that donations will always be flows, and never one-time transfers. Would you say this logic needs to be changed so that Frequency.OneTime also uses supportFlow or supportFlowWithSwap?

      if (frequency === Frequency.OneTime) {
        await supportSingleTransferAndCall();
      } else if (currency === 'G$') {
        await supportFlow();
      } else {
        await supportFlowWithSwap();
      }

@krisbitney krisbitney requested a review from sirpy January 6, 2024 05:56
@krisbitney krisbitney changed the base branch from kris/realtime-donation-flow to web3Integrations January 7, 2024 06:35
@sirpy
Copy link
Contributor

sirpy commented Jan 7, 2024

@sirpy You mentioned in the other PR that donations will always be flows, and never one-time transfers. Would you say this logic needs to be changed so that Frequency.OneTime also uses supportFlow or supportFlowWithSwap?

      if (frequency === Frequency.OneTime) {
        await supportSingleTransferAndCall();
      } else if (currency === 'G$') {
        await supportFlow();
      } else {
        await supportFlowWithSwap();
      }

What I ment was that the total donation is always composed of single funds donated + streams, so it must be shown as a stream.
What stewards earn is currently always in single payments not streams involved.

@@ -145,7 +145,8 @@ function DonateComponent({ collective }: DonateComponentProps) {

const isInsufficientBalance = donorCurrencyBalance ? totalDecimalDonation > donorCurrencyBalance : true;
const isInsufficientLiquidity = currency !== 'G$' && swapRouteStatus !== SwapRouteState.READY;
const isUnacceptablePriceImpact = currency !== 'G$' && priceImpact ? priceImpact.gte(0.1) : false;
// TODO: what is an acceptable price impact?
const isUnacceptablePriceImpact = currency !== 'G$' && priceImpact ? priceImpact.gte(10) : false;
Copy link
Contributor

Choose a reason for hiding this comment

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

i think 5%.
What does the UI specifications says? is there an alert?
@patpedrosa @decentralauren

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the example says 36%, but i don't think that's intended as the cutoff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to 5% for now, and also moved it to models/constants.ts so it is easier to find if you want to change it later

Comment on lines 83 to 84
const rawMinimumAmountOut = route.trade.minimumAmountOut(slippageTolerance).numerator.toString();
const priceImpact = new Decimal(route.trade.priceImpact.toFixed(4));
Copy link
Contributor

Choose a reason for hiding this comment

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

why is price impact converted here? to Decimal?

Copy link
Contributor Author

@krisbitney krisbitney Jan 7, 2024

Choose a reason for hiding this comment

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

It was so it could be compared to a number, and also to remove trailing zeroes. It could be number instead of Decimal. I just changed it in a new commit.

@krisbitney krisbitney requested review from sirpy and L03TJ3 January 9, 2024 05:35
@L03TJ3 L03TJ3 merged commit 6798a21 into web3Integrations Jan 9, 2024
1 check passed
L03TJ3 added a commit that referenced this pull request Jan 18, 2024
* fix: running format

* fix: header

* fix: header

* View COllective, Donors and Stewards initial UI

* Adding different views such as donors, stewards, wallet profile

* fix: fake data for pages

* General UI improvements

* trigger vercel deployment

* develop branch, merged with master, fixed conflicts. + formatting/linting

* Fix missing import

* set unused var rule to error

* remove lint unused-var rules

* chore: n.base query

* Design QA changes

Issue #7 to #14

* Initial re-work UI for desktop based on latest changes

* Initial re-work UI for desktop based on latest changes

* deps

* deps

* Add typeform to create a good collective button

* Wagmi integration

* conditional render of address or ens. Truncate address shown

* Desktop

* wagmi, routing, superfluid

* wagmi, routing, superfluid

* Fix currency

* Update develop format

* wagmi, routing, superfluid

* Dynamic data template for payment pools

* supporter and steward

* Add missing param in event

* viaIr, new events

* Integrated Real Time Data

* wagmi fix all data hooked up

* wagmi fix all data hooked up

* yarn lock

* fix: yarn lock

* fix: restore master yarn lock

* feat: btn

* fix: sdk build

* fix: esm export

* Working through SuperToken Initialization Error: There was an error initializing the SuperToken, last part needed it to get the contract fucntion to pass

* Done

* .

* fix: hardhat lint

* add: override reward

* add: deployed upgraded pool with override

* fix: contracts types build

* fix: ethers typescript errors

* fix: types

* update

* updated subgraph

* Put back functions lost

* fix: deploy preview on udpates to PR

* wip: test preview yml

* fix: lock file

* Update donor

* add: tsc lint-staged

* fix: lock issue

* fix: typescript jsx transform

* Update donor

* .

* fix: unit tests

* .

* update

* Fix: build

* fix: unit tests

* fix: build correctly

* wip: fix PR test

* Update readme to clarify that packages must be built locally

* Attempt to port existing desktop wallet connection handling to mobile

* fix: event quantity

* refactor: package.json

* Point to working subgraph

* refactored header and changed wallet connect buttons layout to menu

* added todo item

* fixed wallet connector dropdown offset

* animated wallet connector menu button arrow

* Collective Home Card description is now limited to 3 lines and expands on click

* reduced width of desktop home collective card containers so they more closely resemble the mobile card containers

* fixed padding on ViewCollective page and did some touchups on stewards list

* fixed CTA button size on DonationPage

* fixed Breadcrumb on DonationPage

* fixed icon alignment on ViewCollective page

* added random profile pics for stewards

* fixes for layout of ViewStewards page on mobile

* small refactors while trying to figure out why "see all stewards" button isn't working on desktop

* set gap between stewards and transactions to 32 on desktop ViewCollective page

* refactored subgraph data fetching

* fix: empty arrays, relations

* wip: subgraph fixes

* additional refactoring of models

* small progress made in adding dynamic data

* reworked subgraph; added entities for StewardCollective, Reward, DonorCollective, and Donation

* updated pool creation in subgraph

* adjusted Collective schema

* made all fields non-nullable since they all have values when instantiated

* removed 'contributions' summary value from Collective

* added summary statistics to Collective

* updated contribution calculations for donors in subgraph

* added dev comments in schema for clarity

* reworked subgraph queries and model transforms (build broken)

* added dynamic data to ViewCollective and ViewStewards (build broken)

* updated wallet profile page

* removed unused pages and fixed build

* added ipfs data parsing and removed unused reward/donation code

* fixed ipfs collective id

* Add: Design system (#54)

* add: design system, svg support

* add: svg default exports, apply svg icons to ViewCollective

* - add withTheme hook for the AboutCard
- add theme also to native provider

* fix: apply styles for aboutcard better, add readme

* fix: forgot to comment out web3modal

* chore: bump good-design

* Update README.md

* front end now obtains ipfs data from subgraph instead of fetching directly from ipfs

* minor refactoring

* made event-claim relationship m:1

* fix: exluded deps from bundle

* fix for desktop padding on view collective page

* added tsconfig for assemblyscript in subgraph package

* updated ViewDonorsPage and its components

* added correct Collective metadata to donate page

* added ipfs collective metadata update to handlePoolDetailsChanged

* changed variable name 'nftAddress' to 'nftId' in subgraph pool.ts; changed derivedFrom relationships in collective

* removed deriveFrom relationship from eventdata claim

* reconfigured subgraph to recognize factory-template relationship between poolfactory and pool

* fix: subgraph null, ipfs, mappings file

* ensured required values in subgraph entities are populated

* update yarn.lock

* fixed assemblyscript config extension path

* updated DonateComponent to determine if balance is sufficient; removed @Constants dir

* added donation timestamp to DonorCollective (needed for superfluid real-time updates)

* added donation timestamp to DonorCollective (needed for superfluid real-time updates)

* removed missed usages of @Constants folder

* fix: yarn lock

* displaying realtime superfluid donations (untested)

* fixed null values in handleRewardClaim NFT

* updated yarn lock

* updated yarn lock

* using hex string for pool project id due to invalid utf-8 data

* removed ipfs retries since they don't seem to help

* fixed Claim totalRewards initialization

* reworked ipfs usage in subgraph to use new data source feature

* updated data flow to accomodate subgraph updates

* add required fields to ipfs entity in subgraph

* adjusted ipfs fetching in front end

* renamed IpfsCollective.address to IpfsCollective.collective

* removed IpfsCollective.collective

* fixes to subgraph ipfs fetching in front end

* removed several hard-coded SVG strings

* several minor fixes

* various minor fixes

* reworked wallet profile UI

* removed use of `window`

* refactored useGetBalance

* post-merge fixes

* removed unused constants

* removed redundant view from ViewStewardsPage.tsx

* removed unused styles from ViewStewardsPage.tsx

* removed unused styles from ViewDonorsPage.tsx

* ui fixes ViewStewardsPage and ViewDonorsPage

* removed unused import and console log

* updated useContractCalls and much of DonateComponent

* fixed double usage of insufficientLiquidity

* simplified DonorListItem ranks

* ProfileView refactor

* added useApproveSwapTokenCallback and useSwapRoute

* removed mock data

* draft swap integration

* added index to hooks/useContractCalls

* prevented swap from G$ to G$

* fixed formatting and some swap bugs

* removed unused function from lib

* added flowing balances for total donation amounts for collectives and donors

* added useTokenList hook

* now using celo token list

* removed unused import

* made dropdown menu scrollable

* added storage cache to apollo client

* swap works!

* adjustments to reflect uniswap default slippage tolerance

* fixed jsbi via vite configuration

* changed priceImpact to number

* updated default apollo client fetch policy to 'cache-and-network'

* removed unused `WalletConnectionProvider` context

* by request, handleApproveToken is no longer memoized

* fixed GD formatting in Donor List

* changed acceptable price impact percent to 5% and moved it to constants.ts

* add swap and fix donate (#72)

* updated useContractCalls and much of DonateComponent

* added useApproveSwapTokenCallback and useSwapRoute

* draft swap integration

* added index to hooks/useContractCalls

* prevented swap from G$ to G$

* fixed formatting and some swap bugs

* removed unused function from lib

* now using celo token list

* removed unused import

* made dropdown menu scrollable

* swap works!

* adjustments to reflect uniswap default slippage tolerance

* fixed jsbi via vite configuration

* changed priceImpact to number

* removed unused `WalletConnectionProvider` context

* by request, handleApproveToken is no longer memoized

* fixed GD formatting in Donor List

* changed acceptable price impact percent to 5% and moved it to constants.ts

* added steward verification check

* added currentPool value fetching

* added "people supported" counts

* fixed for useIsStewardVerified and added FlowingDonationsRowItem to reduce re-renders

* fixes for currentPool, donor list

* fix for ens name support

* Bug fixes (#111)

* fix social links and show only if available

* changed DonorListItem amount display from toFixed to toString

* sort connectors with WalletConnect before MetaMask

* added token symbol next to wallet balance and adjusted balance formatting

* update copy for on-time donation, added chain check to useEthersSigner and useGetTokenBalance

* one-time transfer now assumes token is already approved for transfer

* G$ donation now assumes token is already approved for transfer

* added infoButton property to ipfs meta data in subgraph

* increased slippage tolerance from 0.5% to 1%

* made it so only G$ shows in token list for one-time donations

* made it so selecting one-time donation changes currency to G$ and amount to 0

* fixed total donation usd value

* swap errors will only show if donation amount is not zero

* added infoLabel to front end

* updated breadcrumb to show collective name and only go back to previous page if back arrow is clicked

* updated breadcrumb to fix links and text

* incremented subgraph starting block because prior block was failing

* donation is now disabled if swap required and token approval not yet ready; token approval should not fail on retry

* breadcrumb formatting for '/'

* adjusted G$ formatting in profile

* modal and donation error formatting

* added steward profile link to steward list item

* added polling to donor in wallet; improved error message in donation functions

* fix for error message in donation functions

* switched from supportSingleTransferAndCall to supportSingleBatch since it includes token approval

* removed warnings for missing subgraph items

* set margin between collective cards on home page to 24

* fixed transaction list UI

* added useRecentTransactions hook

* fixed ViewCollective tablet portrait resolution

* removed G$ fractional amount from connected wallet display, and added currency symbol to mobile version

* made sure G$ displayed amount is rounded down to nearest int

* fixed stop donation

* changed default gas price to 5 in @gooddollar/goodcollective-sdk

* renamed enum value from celo to CELO

* currentPool is now a flowing balance

* refactor: dry up donate button styles, no inline arrow functions

* fix: getDonateStyles, does not stop loop after hitting first true

* fix: simplify getDonateStyles

* inline lambdas to const

* memoized onChangeFrequency

* fixed link to smart contract in ViewCollective

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* chore: release sdk, bump in app

---------

Co-authored-by: LewisB <[email protected]>

---------

Co-authored-by: Luis Castillo <[email protected]>
Co-authored-by: LewisB <[email protected]>
Co-authored-by: Fernando Torres <[email protected]>
Co-authored-by: Joshua-Jack <[email protected]>
Co-authored-by: Ben Walker <[email protected]>
Co-authored-by: kris <[email protected]>
Co-authored-by: Lewis B <[email protected]>
L03TJ3 added a commit that referenced this pull request Jan 19, 2024
* Initial re-work UI for desktop based on latest changes

* deps

* deps

* Add typeform to create a good collective button

* Wagmi integration

* conditional render of address or ens. Truncate address shown

* Desktop

* wagmi, routing, superfluid

* wagmi, routing, superfluid

* Fix currency

* Update develop format

* wagmi, routing, superfluid

* Dynamic data template for payment pools

* supporter and steward

* Add missing param in event

* viaIr, new events

* Integrated Real Time Data

* wagmi fix all data hooked up

* wagmi fix all data hooked up

* yarn lock

* fix: yarn lock

* fix: restore master yarn lock

* feat: btn

* fix: sdk build

* fix: esm export

* Working through SuperToken Initialization Error: There was an error initializing the SuperToken, last part needed it to get the contract fucntion to pass

* Done

* .

* fix: hardhat lint

* add: override reward

* add: deployed upgraded pool with override

* fix: contracts types build

* fix: ethers typescript errors

* fix: types

* update

* updated subgraph

* Put back functions lost

* fix: deploy preview on udpates to PR

* wip: test preview yml

* fix: lock file

* Update donor

* add: tsc lint-staged

* fix: lock issue

* fix: typescript jsx transform

* Update donor

* .

* fix: unit tests

* .

* update

* Fix: build

* fix: unit tests

* fix: build correctly

* wip: fix PR test

* Update readme to clarify that packages must be built locally

* Attempt to port existing desktop wallet connection handling to mobile

* fix: event quantity

* refactor: package.json

* Point to working subgraph

* refactored header and changed wallet connect buttons layout to menu

* added todo item

* fixed wallet connector dropdown offset

* animated wallet connector menu button arrow

* Collective Home Card description is now limited to 3 lines and expands on click

* reduced width of desktop home collective card containers so they more closely resemble the mobile card containers

* fixed padding on ViewCollective page and did some touchups on stewards list

* fixed CTA button size on DonationPage

* fixed Breadcrumb on DonationPage

* fixed icon alignment on ViewCollective page

* added random profile pics for stewards

* fixes for layout of ViewStewards page on mobile

* small refactors while trying to figure out why "see all stewards" button isn't working on desktop

* set gap between stewards and transactions to 32 on desktop ViewCollective page

* refactored subgraph data fetching

* fix: empty arrays, relations

* wip: subgraph fixes

* additional refactoring of models

* small progress made in adding dynamic data

* reworked subgraph; added entities for StewardCollective, Reward, DonorCollective, and Donation

* updated pool creation in subgraph

* adjusted Collective schema

* made all fields non-nullable since they all have values when instantiated

* removed 'contributions' summary value from Collective

* added summary statistics to Collective

* updated contribution calculations for donors in subgraph

* added dev comments in schema for clarity

* reworked subgraph queries and model transforms (build broken)

* added dynamic data to ViewCollective and ViewStewards (build broken)

* updated wallet profile page

* removed unused pages and fixed build

* added ipfs data parsing and removed unused reward/donation code

* fixed ipfs collective id

* Add: Design system (#54)

* add: design system, svg support

* add: svg default exports, apply svg icons to ViewCollective

* - add withTheme hook for the AboutCard
- add theme also to native provider

* fix: apply styles for aboutcard better, add readme

* fix: forgot to comment out web3modal

* chore: bump good-design

* Update README.md

* front end now obtains ipfs data from subgraph instead of fetching directly from ipfs

* minor refactoring

* made event-claim relationship m:1

* fix: exluded deps from bundle

* fix for desktop padding on view collective page

* added tsconfig for assemblyscript in subgraph package

* updated ViewDonorsPage and its components

* added correct Collective metadata to donate page

* added ipfs collective metadata update to handlePoolDetailsChanged

* changed variable name 'nftAddress' to 'nftId' in subgraph pool.ts; changed derivedFrom relationships in collective

* removed deriveFrom relationship from eventdata claim

* reconfigured subgraph to recognize factory-template relationship between poolfactory and pool

* fix: subgraph null, ipfs, mappings file

* ensured required values in subgraph entities are populated

* update yarn.lock

* fixed assemblyscript config extension path

* updated DonateComponent to determine if balance is sufficient; removed @Constants dir

* added donation timestamp to DonorCollective (needed for superfluid real-time updates)

* added donation timestamp to DonorCollective (needed for superfluid real-time updates)

* removed missed usages of @Constants folder

* fix: yarn lock

* displaying realtime superfluid donations (untested)

* fixed null values in handleRewardClaim NFT

* updated yarn lock

* updated yarn lock

* using hex string for pool project id due to invalid utf-8 data

* removed ipfs retries since they don't seem to help

* fixed Claim totalRewards initialization

* reworked ipfs usage in subgraph to use new data source feature

* updated data flow to accomodate subgraph updates

* add required fields to ipfs entity in subgraph

* adjusted ipfs fetching in front end

* renamed IpfsCollective.address to IpfsCollective.collective

* removed IpfsCollective.collective

* fixes to subgraph ipfs fetching in front end

* removed several hard-coded SVG strings

* several minor fixes

* various minor fixes

* reworked wallet profile UI

* removed use of `window`

* refactored useGetBalance

* post-merge fixes

* removed unused constants

* removed redundant view from ViewStewardsPage.tsx

* removed unused styles from ViewStewardsPage.tsx

* removed unused styles from ViewDonorsPage.tsx

* ui fixes ViewStewardsPage and ViewDonorsPage

* removed unused import and console log

* updated useContractCalls and much of DonateComponent

* fixed double usage of insufficientLiquidity

* simplified DonorListItem ranks

* ProfileView refactor

* added useApproveSwapTokenCallback and useSwapRoute

* removed mock data

* draft swap integration

* added index to hooks/useContractCalls

* prevented swap from G$ to G$

* fixed formatting and some swap bugs

* removed unused function from lib

* added flowing balances for total donation amounts for collectives and donors

* added useTokenList hook

* now using celo token list

* removed unused import

* made dropdown menu scrollable

* added storage cache to apollo client

* swap works!

* adjustments to reflect uniswap default slippage tolerance

* fixed jsbi via vite configuration

* changed priceImpact to number

* updated default apollo client fetch policy to 'cache-and-network'

* removed unused `WalletConnectionProvider` context

* by request, handleApproveToken is no longer memoized

* fixed GD formatting in Donor List

* changed acceptable price impact percent to 5% and moved it to constants.ts

* add swap and fix donate (#72)

* updated useContractCalls and much of DonateComponent

* added useApproveSwapTokenCallback and useSwapRoute

* draft swap integration

* added index to hooks/useContractCalls

* prevented swap from G$ to G$

* fixed formatting and some swap bugs

* removed unused function from lib

* now using celo token list

* removed unused import

* made dropdown menu scrollable

* swap works!

* adjustments to reflect uniswap default slippage tolerance

* fixed jsbi via vite configuration

* changed priceImpact to number

* removed unused `WalletConnectionProvider` context

* by request, handleApproveToken is no longer memoized

* fixed GD formatting in Donor List

* changed acceptable price impact percent to 5% and moved it to constants.ts

* added steward verification check

* added currentPool value fetching

* added "people supported" counts

* fixed for useIsStewardVerified and added FlowingDonationsRowItem to reduce re-renders

* fixes for currentPool, donor list

* fix for ens name support

* Bug fixes (#111)

* fix social links and show only if available

* changed DonorListItem amount display from toFixed to toString

* sort connectors with WalletConnect before MetaMask

* added token symbol next to wallet balance and adjusted balance formatting

* update copy for on-time donation, added chain check to useEthersSigner and useGetTokenBalance

* one-time transfer now assumes token is already approved for transfer

* G$ donation now assumes token is already approved for transfer

* added infoButton property to ipfs meta data in subgraph

* increased slippage tolerance from 0.5% to 1%

* made it so only G$ shows in token list for one-time donations

* made it so selecting one-time donation changes currency to G$ and amount to 0

* fixed total donation usd value

* swap errors will only show if donation amount is not zero

* added infoLabel to front end

* updated breadcrumb to show collective name and only go back to previous page if back arrow is clicked

* updated breadcrumb to fix links and text

* incremented subgraph starting block because prior block was failing

* donation is now disabled if swap required and token approval not yet ready; token approval should not fail on retry

* breadcrumb formatting for '/'

* adjusted G$ formatting in profile

* modal and donation error formatting

* added steward profile link to steward list item

* added polling to donor in wallet; improved error message in donation functions

* fix for error message in donation functions

* switched from supportSingleTransferAndCall to supportSingleBatch since it includes token approval

* removed warnings for missing subgraph items

* set margin between collective cards on home page to 24

* fixed transaction list UI

* added useRecentTransactions hook

* fixed ViewCollective tablet portrait resolution

* removed G$ fractional amount from connected wallet display, and added currency symbol to mobile version

* made sure G$ displayed amount is rounded down to nearest int

* fixed stop donation

* changed default gas price to 5 in @gooddollar/goodcollective-sdk

* renamed enum value from celo to CELO

* currentPool is now a flowing balance

* refactor: dry up donate button styles, no inline arrow functions

* fix: getDonateStyles, does not stop loop after hitting first true

* fix: simplify getDonateStyles

* inline lambdas to const

* memoized onChangeFrequency

* fixed link to smart contract in ViewCollective

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* chore: release sdk, bump in app

---------

Co-authored-by: LewisB <[email protected]>

* added SupportEvent to subgraph

* Added collective id to Claim in subgraph

* added donor and collective to SupportEvent in subgraph

* fix for subgraph

* changed Claim id to tx hash in subgraph

* changed Claim back to event uri in subgraph; added txHash to Claim instead

* added network fee as an optional parameter in subgraph event entities

* added timestamp to Claim in subgraph

* changed timestamp types to Int in subgraph

* updated transaction list and added hooks to fetch transactions

* updated subgraph network fee properties

* fixes for transaction fetching

* updated tx hash formatting to match design spec

* removed OK button from CompleteDonationModal and fixed image height in empty profile

* adjusted poll intervals

* added thank you modal and stop donation modal to desktop ViewCollective

* fixed thank you modal behavior

---------

Co-authored-by: Luis Castillo <[email protected]>
Co-authored-by: Joshua-Jack <[email protected]>
Co-authored-by: sirpy <[email protected]>
Co-authored-by: LewisB <[email protected]>
Co-authored-by: Ben Walker <[email protected]>
Co-authored-by: sirpy <[email protected]>
Co-authored-by: Lewis B <[email protected]>
L03TJ3 added a commit that referenced this pull request Jan 21, 2024
* Working through SuperToken Initialization Error: There was an error initializing the SuperToken, last part needed it to get the contract fucntion to pass

* Done

* .

* fix: hardhat lint

* add: override reward

* add: deployed upgraded pool with override

* fix: contracts types build

* fix: ethers typescript errors

* fix: types

* update

* updated subgraph

* Put back functions lost

* fix: deploy preview on udpates to PR

* wip: test preview yml

* fix: lock file

* Update donor

* add: tsc lint-staged

* fix: lock issue

* fix: typescript jsx transform

* Update donor

* .

* fix: unit tests

* .

* update

* Fix: build

* fix: unit tests

* fix: build correctly

* wip: fix PR test

* Update readme to clarify that packages must be built locally

* Attempt to port existing desktop wallet connection handling to mobile

* fix: event quantity

* refactor: package.json

* Point to working subgraph

* refactored header and changed wallet connect buttons layout to menu

* added todo item

* fixed wallet connector dropdown offset

* animated wallet connector menu button arrow

* Collective Home Card description is now limited to 3 lines and expands on click

* reduced width of desktop home collective card containers so they more closely resemble the mobile card containers

* fixed padding on ViewCollective page and did some touchups on stewards list

* fixed CTA button size on DonationPage

* fixed Breadcrumb on DonationPage

* fixed icon alignment on ViewCollective page

* added random profile pics for stewards

* fixes for layout of ViewStewards page on mobile

* small refactors while trying to figure out why "see all stewards" button isn't working on desktop

* set gap between stewards and transactions to 32 on desktop ViewCollective page

* refactored subgraph data fetching

* fix: empty arrays, relations

* wip: subgraph fixes

* additional refactoring of models

* small progress made in adding dynamic data

* reworked subgraph; added entities for StewardCollective, Reward, DonorCollective, and Donation

* updated pool creation in subgraph

* adjusted Collective schema

* made all fields non-nullable since they all have values when instantiated

* removed 'contributions' summary value from Collective

* added summary statistics to Collective

* updated contribution calculations for donors in subgraph

* added dev comments in schema for clarity

* reworked subgraph queries and model transforms (build broken)

* added dynamic data to ViewCollective and ViewStewards (build broken)

* updated wallet profile page

* removed unused pages and fixed build

* added ipfs data parsing and removed unused reward/donation code

* fixed ipfs collective id

* Add: Design system (#54)

* add: design system, svg support

* add: svg default exports, apply svg icons to ViewCollective

* - add withTheme hook for the AboutCard
- add theme also to native provider

* fix: apply styles for aboutcard better, add readme

* fix: forgot to comment out web3modal

* chore: bump good-design

* Update README.md

* front end now obtains ipfs data from subgraph instead of fetching directly from ipfs

* minor refactoring

* made event-claim relationship m:1

* fix: exluded deps from bundle

* fix for desktop padding on view collective page

* added tsconfig for assemblyscript in subgraph package

* updated ViewDonorsPage and its components

* added correct Collective metadata to donate page

* added ipfs collective metadata update to handlePoolDetailsChanged

* changed variable name 'nftAddress' to 'nftId' in subgraph pool.ts; changed derivedFrom relationships in collective

* removed deriveFrom relationship from eventdata claim

* reconfigured subgraph to recognize factory-template relationship between poolfactory and pool

* fix: subgraph null, ipfs, mappings file

* ensured required values in subgraph entities are populated

* update yarn.lock

* fixed assemblyscript config extension path

* updated DonateComponent to determine if balance is sufficient; removed @Constants dir

* added donation timestamp to DonorCollective (needed for superfluid real-time updates)

* added donation timestamp to DonorCollective (needed for superfluid real-time updates)

* removed missed usages of @Constants folder

* fix: yarn lock

* displaying realtime superfluid donations (untested)

* fixed null values in handleRewardClaim NFT

* updated yarn lock

* updated yarn lock

* using hex string for pool project id due to invalid utf-8 data

* removed ipfs retries since they don't seem to help

* fixed Claim totalRewards initialization

* reworked ipfs usage in subgraph to use new data source feature

* updated data flow to accomodate subgraph updates

* add required fields to ipfs entity in subgraph

* adjusted ipfs fetching in front end

* renamed IpfsCollective.address to IpfsCollective.collective

* removed IpfsCollective.collective

* fixes to subgraph ipfs fetching in front end

* removed several hard-coded SVG strings

* several minor fixes

* various minor fixes

* reworked wallet profile UI

* removed use of `window`

* refactored useGetBalance

* post-merge fixes

* removed unused constants

* removed redundant view from ViewStewardsPage.tsx

* removed unused styles from ViewStewardsPage.tsx

* removed unused styles from ViewDonorsPage.tsx

* ui fixes ViewStewardsPage and ViewDonorsPage

* removed unused import and console log

* updated useContractCalls and much of DonateComponent

* fixed double usage of insufficientLiquidity

* simplified DonorListItem ranks

* ProfileView refactor

* added useApproveSwapTokenCallback and useSwapRoute

* removed mock data

* draft swap integration

* added index to hooks/useContractCalls

* prevented swap from G$ to G$

* fixed formatting and some swap bugs

* removed unused function from lib

* added flowing balances for total donation amounts for collectives and donors

* added useTokenList hook

* now using celo token list

* removed unused import

* made dropdown menu scrollable

* added storage cache to apollo client

* swap works!

* adjustments to reflect uniswap default slippage tolerance

* fixed jsbi via vite configuration

* changed priceImpact to number

* updated default apollo client fetch policy to 'cache-and-network'

* removed unused `WalletConnectionProvider` context

* by request, handleApproveToken is no longer memoized

* fixed GD formatting in Donor List

* changed acceptable price impact percent to 5% and moved it to constants.ts

* add swap and fix donate (#72)

* updated useContractCalls and much of DonateComponent

* added useApproveSwapTokenCallback and useSwapRoute

* draft swap integration

* added index to hooks/useContractCalls

* prevented swap from G$ to G$

* fixed formatting and some swap bugs

* removed unused function from lib

* now using celo token list

* removed unused import

* made dropdown menu scrollable

* swap works!

* adjustments to reflect uniswap default slippage tolerance

* fixed jsbi via vite configuration

* changed priceImpact to number

* removed unused `WalletConnectionProvider` context

* by request, handleApproveToken is no longer memoized

* fixed GD formatting in Donor List

* changed acceptable price impact percent to 5% and moved it to constants.ts

* added steward verification check

* added currentPool value fetching

* added "people supported" counts

* fixed for useIsStewardVerified and added FlowingDonationsRowItem to reduce re-renders

* fixes for currentPool, donor list

* fix for ens name support

* fix social links and show only if available

* changed DonorListItem amount display from toFixed to toString

* sort connectors with WalletConnect before MetaMask

* added token symbol next to wallet balance and adjusted balance formatting

* update copy for on-time donation, added chain check to useEthersSigner and useGetTokenBalance

* one-time transfer now assumes token is already approved for transfer

* G$ donation now assumes token is already approved for transfer

* added infoButton property to ipfs meta data in subgraph

* increased slippage tolerance from 0.5% to 1%

* made it so only G$ shows in token list for one-time donations

* made it so selecting one-time donation changes currency to G$ and amount to 0

* fixed total donation usd value

* swap errors will only show if donation amount is not zero

* added infoLabel to front end

* updated breadcrumb to show collective name and only go back to previous page if back arrow is clicked

* updated breadcrumb to fix links and text

* incremented subgraph starting block because prior block was failing

* donation is now disabled if swap required and token approval not yet ready; token approval should not fail on retry

* breadcrumb formatting for '/'

* adjusted G$ formatting in profile

* modal and donation error formatting

* added steward profile link to steward list item

* added polling to donor in wallet; improved error message in donation functions

* fix for error message in donation functions

* switched from supportSingleTransferAndCall to supportSingleBatch since it includes token approval

* removed warnings for missing subgraph items

* set margin between collective cards on home page to 24

* fixed transaction list UI

* added useRecentTransactions hook

* fixed ViewCollective tablet portrait resolution

* removed G$ fractional amount from connected wallet display, and added currency symbol to mobile version

* made sure G$ displayed amount is rounded down to nearest int

* fixed stop donation

* changed default gas price to 5 in @gooddollar/goodcollective-sdk

* renamed enum value from celo to CELO

* currentPool is now a flowing balance

* refactor: dry up donate button styles, no inline arrow functions

* fix: getDonateStyles, does not stop loop after hitting first true

* fix: simplify getDonateStyles

* inline lambdas to const

* memoized onChangeFrequency

* added support for fetching full user names from mongodb

* added caching to useFetchFullName and fixed realm logout callback

* Bug fixes (#111)

* fix social links and show only if available

* changed DonorListItem amount display from toFixed to toString

* sort connectors with WalletConnect before MetaMask

* added token symbol next to wallet balance and adjusted balance formatting

* update copy for on-time donation, added chain check to useEthersSigner and useGetTokenBalance

* one-time transfer now assumes token is already approved for transfer

* G$ donation now assumes token is already approved for transfer

* added infoButton property to ipfs meta data in subgraph

* increased slippage tolerance from 0.5% to 1%

* made it so only G$ shows in token list for one-time donations

* made it so selecting one-time donation changes currency to G$ and amount to 0

* fixed total donation usd value

* swap errors will only show if donation amount is not zero

* added infoLabel to front end

* updated breadcrumb to show collective name and only go back to previous page if back arrow is clicked

* updated breadcrumb to fix links and text

* incremented subgraph starting block because prior block was failing

* donation is now disabled if swap required and token approval not yet ready; token approval should not fail on retry

* breadcrumb formatting for '/'

* adjusted G$ formatting in profile

* modal and donation error formatting

* added steward profile link to steward list item

* added polling to donor in wallet; improved error message in donation functions

* fix for error message in donation functions

* switched from supportSingleTransferAndCall to supportSingleBatch since it includes token approval

* removed warnings for missing subgraph items

* set margin between collective cards on home page to 24

* fixed transaction list UI

* added useRecentTransactions hook

* fixed ViewCollective tablet portrait resolution

* removed G$ fractional amount from connected wallet display, and added currency symbol to mobile version

* made sure G$ displayed amount is rounded down to nearest int

* fixed stop donation

* changed default gas price to 5 in @gooddollar/goodcollective-sdk

* renamed enum value from celo to CELO

* currentPool is now a flowing balance

* refactor: dry up donate button styles, no inline arrow functions

* fix: getDonateStyles, does not stop loop after hitting first true

* fix: simplify getDonateStyles

* inline lambdas to const

* memoized onChangeFrequency

* fixed link to smart contract in ViewCollective

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* version bump

* chore: release sdk, bump in app

---------

Co-authored-by: LewisB <[email protected]>

* added apollo client for mongo db fetches

* changed apollo client cache policies

* added full name fetching to transactions list items

---------

Co-authored-by: Joshua-Jack <[email protected]>
Co-authored-by: sirpy <[email protected]>
Co-authored-by: LewisB <[email protected]>
Co-authored-by: Ben Walker <[email protected]>
Co-authored-by: sirpy <[email protected]>
Co-authored-by: Lewis B <[email protected]>
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.

3 participants