Skip to content

dTWAP and dLIMIT integration by Orbs #1550

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

Closed
wants to merge 0 commits into from

Conversation

denis-orbs
Copy link
Contributor

@denis-orbs denis-orbs commented Jul 16, 2024

Added dTWAP and dLIMIT pages

demo link

images:
Screenshot 2024-07-16 at 10 30 52
Screenshot 2024-07-16 at 10 31 08
Screenshot 2024-07-16 at 10 32 07

Screenshot 2024-07-16 at 10 32 19


PR-Codex overview

The focus of this PR is to introduce support for a new feature called TWAP (Time-Weighted Average Price) in the SushiSwap UI.

Detailed summary

  • Added keyv to the list of ignored plugins in Webpack configuration
  • Updated dependencies for @orbs-network/twap-ui-sushiswap and other packages
  • Added components and logic for TWAP functionality in the SushiSwap UI

The following files were skipped due to too many changes: pnpm-lock.yaml

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Jul 16, 2024

⚠️ No Changeset found

Latest commit: 7f5f013

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jul 16, 2024

@denis-orbs is attempting to deploy a commit to the Sushi Team on Vercel.

A member of the Team first needs to authorize it.

import { SimpleSwapBridgeBanner } from "./simple/simple-swap-bridge-banner";

const LOGO = {
[ChainId.BASE]: "ethereum.svg",
Copy link
Collaborator

Choose a reason for hiding this comment

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

todo?

return (
<Dialog open={open} onOpenChange={() => onClose()}>
<DialogContent>
{" "}
Copy link
Collaborator

Choose a reason for hiding this comment

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

intentional?

children,
onSelect,
}: {
selected: any;
Copy link
Collaborator

Choose a reason for hiding this comment

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

any (guessing Type would work as in the onSelect type?)

};
};

const usePriceUSD = (address?: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

address should have the Address type from viem


const useTokenList = () => {
const { data: customTokenMap } = useCustomTokens();
const chainId = useDerivedStateSimpleSwap().state.chainId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above with the pattern


const { data: otherTokenMap } = useOtherTokenListsQuery({
chainId,
query: "",
Copy link
Collaborator

Choose a reason for hiding this comment

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

ideally query should be optional on useOtherTokenListsQuery, but it's not, think undefined would make more sense than ""

customTokenMap,
tokenMap,
chainId,
balancesMap: {},
Copy link
Collaborator

Choose a reason for hiding this comment

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

balancesMap can be removed

};

export const useIsTwapSupported = () => {
const { state } = useDerivedStateSimpleSwap();
Copy link
Collaborator

Choose a reason for hiding this comment

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

{ state } -> { state: { chainId } }

@LufyCZ
Copy link
Collaborator

LufyCZ commented Jul 16, 2024

A couple more things from your screenshots:

not sure why the xswap icon is white here, it's colored in prod
image

the spacing in the 1 ICON ETH part looks a bit sketchy
image

would add rounding to the "loading" bar
image

typo
image

think we shorten addresses more around the app, would be better if it was consistent
image

Overall though it's pretty visible in some places that your package doesn't use our UI components, wonder what'd be the best way to address that. We want to eventually release @sushiswap/ui, but probably not in the near future (weeks).

Think ideally all the components would live in our app (under apps/web/src/(evm)/swap/(orbs)/...), where they could import our components. The logic could be imported from your sdk. The annoying thing would be upkeep from your side, I get that keeping everything in your repo is nice.

@LufyCZ
Copy link
Collaborator

LufyCZ commented Jul 19, 2024

@denis-orbs I've been looking around your packages and the amount of dependencies they use is honestly too excessive. Lodash is not necessary nowadays at all, and importing the whole thing (with import _ from "lodash"), not allowing three-shaking to do its job is even worse. The whole graph is a bit terrifying, and I don't think we can get this merged in before it's cleaned up.

I've spent the whole of June trying to reduce our bundle sizes and managed to get them down to ~800-900KB for /swap:
image

but after this PR it's immediately up 700KB to 1.6MB:
image

@matthewlilley
Copy link
Collaborator

matthewlilley commented Jul 22, 2024

@denis-orbs In an ideal world we'd prefer to have the business logic live inside our repo and make use of our UI component library.

We have concerns with bundle sizes which as Lufy mentioned has been a key focus in the past couple of months, but also with uneccasary dependencies which themselves could have loose dependecies that could pose a secuirty issue down the line, generally we tend to own rather than clone in a lot of cases these days.

Copy link

socket-security bot commented Jul 30, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] filesystem 0 93.2 kB wighawag

🚮 Removed packages: npm/@types/[email protected], npm/[email protected]

View full report↗︎

Copy link

vercel bot commented Jul 30, 2024

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

Name Status Preview Comments Updated (UTC)
web ❌ Failed (Inspect) Aug 2, 2024 4:32pm

@LufyCZ
Copy link
Collaborator

LufyCZ commented Aug 2, 2024

#1582

recreated the PR here, to get all the checks + the deployment to run

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