Skip to content

Commit

Permalink
Merge pull request #44 from invariant-labs/change-domain-and-navbars
Browse files Browse the repository at this point in the history
change domain and hide tokens
  • Loading branch information
p6te authored Aug 21, 2024
2 parents 1ed4946 + ed1d333 commit 3e3a279
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
VERCEL_SCOPE: ${{ secrets.VERCEL_ORG_ID }}
WORKING_DIRECTORY: frontend
ALIAS_DOMAINS: |
connector.invariant.app
link.invariant.app
10 changes: 5 additions & 5 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://invariant.app/" />
<meta property="og:url" content="https://link.invariant.app/" />
<meta property="og:title" content="Invariant - AMM DEX provided concentrated liquidity" />
<meta
property="og:description"
content="Invariant Link is a toolkit offering the most efficient DEX features, built on the Eclipse blockchain. It provides unparalleled capital efficiency and advanced risk management." />
<meta property="og:image" content="https://invariant.app/favicon-192x192.png" />
<meta property="og:image" content="https://link.invariant.app/favicon-192x192.png" />

<!-- Twitter Card -->
<meta property="twitter:card" content="summary" />
Expand All @@ -42,7 +42,7 @@
<meta
property="twitter:description"
content="Invariant Link is a toolkit offering the most efficient DEX features, built on the Eclipse blockchain. It provides unparalleled capital efficiency and advanced risk management." />
<meta property="twitter:image" content="https://invariant.app/favicon-192x192.png" />
<meta property="twitter:image" content="https://link.invariant.app/favicon-192x192.png" />

<!-- DublinCore -->
<link rel="schema.dcterms" href="https://purl.org/dc/terms/" />
Expand All @@ -52,7 +52,7 @@
lang="en"
content="Invariant Link is a toolkit offering the most efficient DEX features, built on the Eclipse blockchain. It provides unparalleled capital efficiency and advanced risk management." />
<meta name="DC.publisher" content="Invariant" />
<meta name="DC.identifier" content="https://invariant.app/" />
<meta name="DC.identifier" content="https://link.invariant.app/" />
<meta name="DC.format" content="text/html" />
<meta name="DC.type" content="Text" />

Expand All @@ -67,7 +67,7 @@
gtag('config', 'G-TEFDYYTWP3', { cookie_flags: 'SameSite=None;Secure' })
</script>

<link rel="canonical" href="https://invariant.app/" />
<link rel="canonical" href="https://link.invariant.app/" />
<link rel="manifest" href="/manifest.json" />

<style>
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "App",
"name": "Invariant App",
"name": "Invariant Link App",
"icons": [
{
"src": "favicon.ico",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Header: React.FC<IHeader> = ({

const routes = [
{ root: 'liquidity', name: 'Fullrange Tokenizer' },
{ root: 'position', name: 'Fingible Position' },
{ root: 'position', name: 'Active Liquidity Management' },
{ root: 'orderbook', name: 'Orderbook' }
]

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Liquidity/FeeSwitch/FeeSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ export const FeeSwitch: React.FC<IFeeSwitch> = ({
singleTabClasses.root,
index === bestTierIndex ? singleTabClasses.best : undefined
),
selected: singleTabClasses.selected
selected: singleTabClasses.selected,
disabled: singleTabClasses.disabled
}}
disabled={index !== bestTierIndex}
/>
))}
</Tabs>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/Liquidity/FeeSwitch/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export const useSingleTabStyles = makeStyles()(() => {
'&:hover': {
color: colors.white.main
}
},
disabled: {
...typography.heading4,
color: '#3a466b' + ' !important'
}
}
})
Expand Down
33 changes: 21 additions & 12 deletions frontend/src/components/Liquidity/Liquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const Liquidity: React.FC<ILiquidity> = ({
tickSpacing,
// isWaitingForNewPool,
poolIndex,
bestTiers,
// bestTiers,
// canCreateNewPool,
handleAddToken,
commonTokens,
Expand Down Expand Up @@ -182,16 +182,19 @@ export const Liquidity: React.FC<ILiquidity> = ({
return trimLeadingZeros(printBN(result, tokens[printIndex].decimals))
}

const bestTierIndex =
tokenAIndex === null || tokenBIndex === null
? undefined
: (bestTiers.find(
tier =>
(tier.tokenX.equals(tokens[tokenAIndex].assetAddress) &&
tier.tokenY.equals(tokens[tokenBIndex].assetAddress)) ||
(tier.tokenX.equals(tokens[tokenBIndex].assetAddress) &&
tier.tokenY.equals(tokens[tokenAIndex].assetAddress))
)?.bestTierIndex ?? undefined)
// const bestTierIndex =
// tokenAIndex === null || tokenBIndex === null
// ? undefined
// : (bestTiers.find(
// tier =>
// (tier.tokenX.equals(tokens[tokenAIndex].assetAddress) &&
// tier.tokenY.equals(tokens[tokenBIndex].assetAddress)) ||
// (tier.tokenX.equals(tokens[tokenBIndex].assetAddress) &&
// tier.tokenY.equals(tokens[tokenAIndex].assetAddress))
// )?.bestTierIndex ?? undefined)

// Temporary set best tier index as only available
const bestTierIndex = 2

const updatePath = (
index1: number | null,
Expand Down Expand Up @@ -256,7 +259,8 @@ export const Liquidity: React.FC<ILiquidity> = ({
tokenAIndex !== null &&
tokenBIndex !== null &&
tokenADeposit !== null &&
tokenBDeposit !== null
tokenBDeposit !== null &&
tokenAIndex !== tokenBIndex
) {
console.log('sqrt price', sqrtPrice.v.toString(), tickSpacing, getMaxTick(tickSpacing))

Expand All @@ -282,6 +286,11 @@ export const Liquidity: React.FC<ILiquidity> = ({
return '0'
}, [tokenADeposit, tokenBDeposit, poolIndex])

useEffect(() => {
if (bestTierIndex) {
setPositionTokens(tokenAIndex, tokenBIndex, bestTierIndex, true)
}
}, [bestTierIndex])
return (
<Grid container className={classes.wrapper} direction='column'>
{showNoConnected && <NoConnected {...noConnectedBlockerProps} />}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'
import searchIcon from '@static/svg/lupa.svg'
import { theme } from '@static/theme'
import React, { forwardRef, useEffect, useMemo, useRef, useState } from 'react'
Expand All @@ -22,7 +21,6 @@ import {
import { SwapToken } from '@store/selectors/wallet'
import Scrollbars from 'rc-scrollbars'
import icons from '@static/icons'
import { TooltipHover } from '@components/TooltipHover/TooltipHover'
import { PublicKey } from '@solana/web3.js'
import { formatNumbers, printBN, showPrefix } from '@utils/utils'
import { FormatNumberThreshold } from '@store/consts/types'
Expand Down Expand Up @@ -229,12 +227,12 @@ export const SelectTokenModal: React.FC<ISelectTokenModal> = ({
/>
<CardMedia image={searchIcon} className={classes.inputIcon} />
</Grid>
<TooltipHover text='Add token'>
{/* <TooltipHover text='Add token'>
<AddCircleOutlineIcon
className={classes.addIcon}
onClick={() => setIsAddOpen(true)}
/>
</TooltipHover>
</TooltipHover> */}
</Grid>
<Grid container>
<Grid className={classes.commonTokensList}>
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/containers/LiquidityWrapper/LiquidityWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ export const LiquidityWrapper: React.FC<IProps> = ({
// const initialSlippage = localStorage.getItem('INVARIANT_NEW_POSITION_SLIPPAGE') ?? '1'

const calcAmount = (amount: BN, tokenAddress: PublicKey) => {
if (tokenAIndex === null || tokenBIndex === null || poolIndex === null) {
if (
tokenAIndex === null ||
tokenBIndex === null ||
poolIndex === null ||
tokenAIndex === tokenBIndex
) {
return new BN(0)
}

Expand Down Expand Up @@ -163,7 +168,7 @@ export const LiquidityWrapper: React.FC<IProps> = ({
)

const isXtoY = useMemo(() => {
if (tokenAIndex !== null && tokenBIndex !== null) {
if (tokenAIndex !== null && tokenBIndex !== null && tokenAIndex !== tokenBIndex) {
return (
tokens[tokenAIndex].assetAddress.toString() < tokens[tokenBIndex].assetAddress.toString()
)
Expand All @@ -172,7 +177,7 @@ export const LiquidityWrapper: React.FC<IProps> = ({
}, [tokenAIndex, tokenBIndex])

useEffect(() => {
if (tokenAIndex !== null && tokenBIndex !== null) {
if (tokenAIndex !== null && tokenBIndex !== null && tokenAIndex !== tokenBIndex) {
const pair = new Pair(
tokens[tokenAIndex].address,
tokens[tokenBIndex].address,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/store/consts/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ export const bestTiers: Record<NetworkType, BestTier[]> = {
export const commonTokensForNetworks: Record<NetworkType, PublicKey[]> = {
Devnet: [USDC_DEV.address, BTC_DEV.address, WETH_DEV.address],
Mainnet: [],
Testnet: [USDC_TEST.address, BTC_TEST.address, WETH_TEST.address],
// Testnet: [USDC_TEST.address, BTC_TEST.address, WETH_TEST.address],
Testnet: [USDC_TEST.address, BTC_TEST.address],
Localnet: []
}
export const airdropTokens: Record<NetworkType, PublicKey[]> = {
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/store/sagas/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ export function* fetchTokensAccounts(): Generator {
}
}
}
console.log(newAccounts)
console.log(unknownTokens)

yield* put(actions.addTokenAccounts(newAccounts))
yield* put(poolsActions.addTokens(unknownTokens))
}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
USDC_DEV,
USDC_TEST,
WETH_DEV,
WETH_TEST,
addressTickerMap,
defaultPrefixConfig,
defaultThresholds
Expand Down Expand Up @@ -215,8 +214,8 @@ export const getNetworkTokensList = (networkType: NetworkType): Record<string, T
case NetworkType.TESTNET:
return {
[USDC_TEST.address.toString()]: USDC_TEST,
[BTC_TEST.address.toString()]: BTC_TEST,
[WETH_TEST.address.toString()]: WETH_TEST
[BTC_TEST.address.toString()]: BTC_TEST
// [WETH_TEST.address.toString()]: WETH_TEST
}
default:
return {}
Expand Down

0 comments on commit 3e3a279

Please sign in to comment.