Skip to content

feat: uni-v2 pools static generation#6629

Merged
0xApotheosis merged 6 commits intodevelopfrom
feat_uni_v2_pools_static_list
Apr 7, 2024
Merged

feat: uni-v2 pools static generation#6629
0xApotheosis merged 6 commits intodevelopfrom
feat_uni_v2_pools_static_list

Conversation

@gomesalexandre
Copy link
Copy Markdown
Contributor

@gomesalexandre gomesalexandre commented Apr 3, 2024

Description

Moves the UNI-V2 pooling away from web for static UNI-V2 assets.

Note, the diff doesn't contain any removal of getZapperAppTokensOutput. As stated in comments, this method is still used to fetch asset (as we don't have a concept of asset "tags", we can't tag assets as UNI-V2 assets even though they are now static), and pool data (which we still need). However, UNI-V2 assets meta will now be immediately available.

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

closes #6559

Risk

High Risk PRs Require 2 approvals

Low - ensure assets still look sane and UNI-V2 meta/user data is still happy

Note, generatedAssetData got substantially bigger with the addition of the icon property which may or may not be a perf risk?

What protocols, transaction types or contract interactions might be affected by this PR?

Testing

  • Assets and related assets still look sane
  • UNI-V2 meta and user data is still happy

Engineering

  • ☝🏽

Operations

  • ☝🏽

Screenshots (if applicable)

  • Related assets are still happy
image image
  • UNI-V2 meta and user data are still happy
image
  • UNI-V2 assets are happy
image

Copy link
Copy Markdown
Contributor Author

gomesalexandre commented Apr 3, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @gomesalexandre and the rest of your teammates on Graphite Graphite

zapperNetworkToChainId,
} from '../../../src/state/apis/zapper/validators'

const sha256 = (input: string): string => crypto.createHash('sha256').update(input).digest('hex')
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A bunch of reimports here because trying to import from their original source will cause a bunch of errors from our TS paths

Comment thread src/components/StakingVaults/hooks/useFetchOpportunities.tsx Outdated
queryFn: async (_, { dispatch }) => {
// We already have the static assets list in the store, however we need to also fetch it here for 2 reasons
// 1. We still need to fetch the raw data from Zapper, which we can't store dynamically because asset ratios and APY changes
// 2. We have no notion of asset "tags" i.e the notion that these assets are UNI-V2 pools
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Technically, we could remove the await here if we filtered down by UNI-V2 symbol. Not a fan about these heuristics however, and we still need to fetch this to get the akschual pool data (as opposed to assets data), so...

return toAssetId({
chainId,
assetNamespace: 'erc20', // TODO: bep20
assetNamespace: 'erc20',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only ETH mainnet supported

Comment thread src/state/slices/opportunitiesSlice/resolvers/uniV2/index.ts
@gomesalexandre gomesalexandre marked this pull request as ready for review April 3, 2024 18:51
@gomesalexandre gomesalexandre requested a review from a team as a code owner April 3, 2024 18:51
@gomesalexandre gomesalexandre force-pushed the feat_uni_v2_pools_static_list branch from b6f0607 to 77300c3 Compare April 3, 2024 22:33
@gomesalexandre gomesalexandre marked this pull request as draft April 3, 2024 22:37
@gomesalexandre gomesalexandre changed the base branch from develop to feat_many_migrations April 3, 2024 22:37
@gomesalexandre gomesalexandre marked this pull request as ready for review April 3, 2024 22:37
@gomesalexandre gomesalexandre marked this pull request as draft April 3, 2024 22:42
@gomesalexandre gomesalexandre marked this pull request as ready for review April 3, 2024 22:42
Base automatically changed from feat_many_migrations to develop April 4, 2024 00:54
@gomesalexandre gomesalexandre marked this pull request as draft April 4, 2024 07:33
@gomesalexandre gomesalexandre marked this pull request as ready for review April 4, 2024 07:33
@gomesalexandre gomesalexandre force-pushed the feat_uni_v2_pools_static_list branch from 77300c3 to c777c25 Compare April 4, 2024 07:33
@gomesalexandre gomesalexandre marked this pull request as draft April 4, 2024 07:34
@gomesalexandre gomesalexandre marked this pull request as ready for review April 4, 2024 07:34
@gomesalexandre gomesalexandre marked this pull request as draft April 4, 2024 07:34
@gomesalexandre gomesalexandre force-pushed the feat_uni_v2_pools_static_list branch from c777c25 to 8ee182e Compare April 4, 2024 07:34
@gomesalexandre gomesalexandre marked this pull request as ready for review April 4, 2024 07:34
@0xApotheosis 0xApotheosis self-assigned this Apr 7, 2024
import z from 'myzod'
import { isNonEmpty, isUrl } from 'lib/utils'

// Redeclared here to make these two utils work in scripts
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah yes, I've tried to solve this conundrum before and ended up doing the same thing 😞

Copy link
Copy Markdown
Member

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

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

✅ Assets look the same as production, both with an without cache.
✅ WETH is correctly shown as ETH where appropriate
✅ General asset sanity check passed (related assets etc)


const assetId = toAssetId({
chainId,
assetNamespace: 'erc20',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use ASSET_NAMESPACE.erc20 here, or is it the case that it can't be imported into the script?

@0xApotheosis 0xApotheosis merged commit 0da4bb9 into develop Apr 7, 2024
@0xApotheosis 0xApotheosis deleted the feat_uni_v2_pools_static_list branch April 7, 2024 22:08
0xApotheosis pushed a commit that referenced this pull request Apr 7, 2024
* feat: uni-v2 pools static generation

* feat: revert DynamicLpAssets flag

* feat: regen

* feat: cleanup asset upserty bits

* feat: regen
0xApotheosis added a commit that referenced this pull request Apr 10, 2024
* add watch asset functionality

* feat: regenerate asset data 04/02/2024 (#6620)

* feat: disable sym deposits after RUNE (#6622)

* fix: don't bork asset generation on idle API failures (#6619)

* feat: collect 0x trade surplus (#6625)

* feat: bottom sheet dialog (#6623)

* add bottom sheet dialog

* try out vaul

* hook up send

* Create SubPage.tsx

* adjusting dialog header

* Update DialogCloseButton.tsx

* add new action menu

* updates

* update more height stuff

* use 100dvh instead of vh

* use 100vh

* anchor footer at the bottom of the screen

* update new asset search

* Update SelectAssets.tsx

* add min height for regular modals

* Update MobileNavBar.tsx

* remove extra stuff not needed for PR

* remove more stuff not for this PR

* Update AddressInput.tsx

* Update AddressInput.tsx

* Update Dialog.tsx

* Update SelectAssets.tsx

* fix for dialog height

* Update AssetSearch.tsx

---------

Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>

* chore: use unchained proxy endpoints over nownodes proxy (#6606)

* feat: use proxy validation endpoint (#6626)

* feat: use proxy validation endpoint

* chore: improve fn name

* update endpoint

* fix: csp

* fix: tests

* chore: use shapeshift proxy csp

* chore: fail open

---------

Co-authored-by: kaladinlight <35275952+kaladinlight@users.noreply.github.com>

* feat: many migrations (#6631)

* fix: remove portal on account dropdown (#6635)

* account down remove portal

* Update StepRow.tsx

* feat: cow affiliate fees (#6621)

* chore: update app translations (#6638)

* chore: invalidate outdated translations

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

---------

Co-authored-by: Hellhound13 <hellhound13@gmx.at>
Co-authored-by: Jpanam <jorgepana26@hotmail.com>
Co-authored-by: yuki <yuki@beyondclub.xyz>
Co-authored-by: guiribabrb <guilherme.rb.barbosa@gmail.com>
Co-authored-by: Markus Meyer <djarmy@gmail.com>
Co-authored-by: Romko <29romko29@gmail.com>
Co-authored-by: tonyjiang12399 <327904087@qq.com>

* feat: cow quote/unsigned order build cleanup (#6639)

* feat: getFullAppData tests

* feat: cow quote/unsigned order build cleanup

* fix: deep merge opportunities accounts (#6627)

* feat: regenerate asset data 04/04/2024 (#6636)

Co-authored-by: GitHub Action <action@github.com>

* fix: defi aggregated opportunities uniqBy id first (#6628)

* fix: zapperAssetToMaybeAssetId handle base-token as native asset

* fix: filter unique opportunities by id first

* Revert "fix: zapperAssetToMaybeAssetId handle base-token as native asset"

This reverts commit 1ed1a59.

* feat: lending loan summary repayment lock (#6642)

* fix: mobile dashboard routing (#6637)

* feat: thorchain lp disable max deposits (#6645)

* feat: uni-v2 pools static generation (#6629)

* feat: uni-v2 pools static generation

* feat: revert DynamicLpAssets flag

* feat: regen

* feat: cleanup asset upserty bits

* feat: regen

* feat: regenerate asset data 04/08/2024 (#6648)

* feat: thorchain LP charts (#6624)

* add home page

* trigger ci

* Update AssetActions.tsx

* feat: tag foxy as expired opportunity (#6651)

* fix: empty my position pools page (#6656)

Update YourPositions.tsx

* Update src/pages/Home/Home.tsx

Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>

* Update src/state/slices/preferencesSlice/preferencesSlice.ts

Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>

* rename to assetIds

* rework the avatar

* more comments

* add top assets default

* feat: naming

---------

Co-authored-by: woodenfurniture <125113430+woodenfurniture@users.noreply.github.com>
Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>
Co-authored-by: Apotheosis <0xapotheosis@gmail.com>
Co-authored-by: kevin <35275952+kaladinlight@users.noreply.github.com>
Co-authored-by: firebomb1 <88804546+firebomb1@users.noreply.github.com>
Co-authored-by: Hellhound13 <hellhound13@gmx.at>
Co-authored-by: Jpanam <jorgepana26@hotmail.com>
Co-authored-by: yuki <yuki@beyondclub.xyz>
Co-authored-by: guiribabrb <guilherme.rb.barbosa@gmail.com>
Co-authored-by: Markus Meyer <djarmy@gmail.com>
Co-authored-by: Romko <29romko29@gmail.com>
Co-authored-by: tonyjiang12399 <327904087@qq.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Apotheosis <97164662+0xApotheosis@users.noreply.github.com>
0xApotheosis added a commit that referenced this pull request Apr 16, 2024
* feat: regenerate asset data 04/02/2024 (#6620)

* feat: disable sym deposits after RUNE (#6622)

* fix: don't bork asset generation on idle API failures (#6619)

* feat: collect 0x trade surplus (#6625)

* feat: bottom sheet dialog (#6623)

* add bottom sheet dialog

* try out vaul

* hook up send

* Create SubPage.tsx

* adjusting dialog header

* Update DialogCloseButton.tsx

* add new action menu

* updates

* update more height stuff

* use 100dvh instead of vh

* use 100vh

* anchor footer at the bottom of the screen

* update new asset search

* Update SelectAssets.tsx

* add min height for regular modals

* Update MobileNavBar.tsx

* remove extra stuff not needed for PR

* remove more stuff not for this PR

* Update AddressInput.tsx

* Update AddressInput.tsx

* Update Dialog.tsx

* Update SelectAssets.tsx

* fix for dialog height

* Update AssetSearch.tsx

---------

Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>

* chore: use unchained proxy endpoints over nownodes proxy (#6606)

* feat: use proxy validation endpoint (#6626)

* feat: use proxy validation endpoint

* chore: improve fn name

* update endpoint

* fix: csp

* fix: tests

* chore: use shapeshift proxy csp

* chore: fail open

---------

Co-authored-by: kaladinlight <35275952+kaladinlight@users.noreply.github.com>

* feat: many migrations (#6631)

* fix: remove portal on account dropdown (#6635)

* account down remove portal

* Update StepRow.tsx

* feat: cow affiliate fees (#6621)

* chore: update app translations (#6638)

* chore: invalidate outdated translations

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

* Translate main.json via GitLocalize

---------

Co-authored-by: Hellhound13 <hellhound13@gmx.at>
Co-authored-by: Jpanam <jorgepana26@hotmail.com>
Co-authored-by: yuki <yuki@beyondclub.xyz>
Co-authored-by: guiribabrb <guilherme.rb.barbosa@gmail.com>
Co-authored-by: Markus Meyer <djarmy@gmail.com>
Co-authored-by: Romko <29romko29@gmail.com>
Co-authored-by: tonyjiang12399 <327904087@qq.com>

* feat: cow quote/unsigned order build cleanup (#6639)

* feat: getFullAppData tests

* feat: cow quote/unsigned order build cleanup

* fix: deep merge opportunities accounts (#6627)

* feat: regenerate asset data 04/04/2024 (#6636)

Co-authored-by: GitHub Action <action@github.com>

* fix: defi aggregated opportunities uniqBy id first (#6628)

* fix: zapperAssetToMaybeAssetId handle base-token as native asset

* fix: filter unique opportunities by id first

* Revert "fix: zapperAssetToMaybeAssetId handle base-token as native asset"

This reverts commit 1ed1a59.

* feat: lending loan summary repayment lock (#6642)

* fix: mobile dashboard routing (#6637)

* feat: thorchain lp disable max deposits (#6645)

* feat: uni-v2 pools static generation (#6629)

* feat: uni-v2 pools static generation

* feat: revert DynamicLpAssets flag

* feat: regen

* feat: cleanup asset upserty bits

* feat: regen

* feat: regenerate asset data 04/08/2024 (#6648)

* feat: thorchain LP charts (#6624)

* feat: tag foxy as expired opportunity (#6651)

* fix: empty my position pools page (#6656)

Update YourPositions.tsx

* feat: add first pass WarningAcknowledgement component

* chore: use translations

* chore: wire up savers deposit

* chore: tidy

* feat: use warningAcknowledgement in trade quote confirm

* feat: use warningAcknowledgement in trade quote confirm

* feat: use warningAcknowledgement in trade lp deposit

* fix: trade quote input warning logic

* chore: use dimmed background

* chore: component a little closer to mock

* chore: component tweaks

* chore: style fixes

* chore: use cancel translation

* fix: trade confirm warning

* Update WarningAcknowledgement.tsx

* Update WarningAcknowledgement.tsx

* feat: chart styles and loading state (#6655)

* fix: thor token repayments (#6676)

* fix: don't render back button on modals initial routes (#6675)

* chore: use translations & constants

* chore: address review feedback

* fix: unbork trade widget size

* fix: show minimum trade amount when unsafe

* fix: trade confirm width

* chore: trigger CI

* fix: typo

* chore: extract motion style to constant

* fix: add no min fallback message

---------

Co-authored-by: woodenfurniture <125113430+woodenfurniture@users.noreply.github.com>
Co-authored-by: gomes <17035424+gomesalexandre@users.noreply.github.com>
Co-authored-by: reallybeard <89934888+reallybeard@users.noreply.github.com>
Co-authored-by: kevin <35275952+kaladinlight@users.noreply.github.com>
Co-authored-by: firebomb1 <88804546+firebomb1@users.noreply.github.com>
Co-authored-by: Hellhound13 <hellhound13@gmx.at>
Co-authored-by: Jpanam <jorgepana26@hotmail.com>
Co-authored-by: yuki <yuki@beyondclub.xyz>
Co-authored-by: guiribabrb <guilherme.rb.barbosa@gmail.com>
Co-authored-by: Markus Meyer <djarmy@gmail.com>
Co-authored-by: Romko <29romko29@gmail.com>
Co-authored-by: tonyjiang12399 <327904087@qq.com>
Co-authored-by: GitHub Action <action@github.com>
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.

Move uni v2 pools into generate-assets script

2 participants