Skip to content

Commit

Permalink
Merge branch 'feat/add-pool-widget' into feat/trinity-x-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
yrjkqq committed Jan 16, 2025
2 parents da33c9c + c770671 commit 92d9bda
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/doc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"dependencies": {
"@babel/runtime": "^7.17.0",
"@dodoex/components": "3.0.1-beta.1",
"@dodoex/widgets": "3.0.2-neox.1",
"@dodoex/components": "^3.0.2-neox.1",
"@dodoex/widgets": "3.0.3-neox.4",
"@emotion/styled": "^11.10.0",
"@storybook/addon-docs": "^8.3.5",
"@web3modal/ethers5": "^3.5.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/dodoex-api/src/chainConfig/contractConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ChainId } from './chain';

const contractMap: {
[key in ChainId]: {
/** MulticallWithValid */
MULTI_CALL: string;
DODO_APPROVE: string;
/** ERC20Helper */
Expand All @@ -19,7 +20,7 @@ const contractMap: {
ROUTE_V1_DATA_FETCH: string;
/** DODOCalleeHelper */
CALLEE_HELPER: string;

/** DODOV2Proxy02 */
DODO_PROXY: string;
/** DODODspProxy */
DODO_DSP_PROXY: string;
Expand Down
12 changes: 6 additions & 6 deletions packages/dodoex-api/src/gql/gql.ts

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions packages/dodoex-api/src/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6644,6 +6644,7 @@ export type Liquidator_OrderBy =
| 'updatedAt';

export type LiquidityApyData = {
metromMiningApy?: Maybe<Scalars['BigDecimal']['output']>;
miningBaseApy?: Maybe<Scalars['BigDecimal']['output']>;
miningQuoteApy?: Maybe<Scalars['BigDecimal']['output']>;
transactionBaseApy?: Maybe<Scalars['BigDecimal']['output']>;
Expand Down Expand Up @@ -8123,6 +8124,17 @@ export type Market_Maker_Pool_ApplypoolApplyData = {
name?: InputMaybe<Scalars['String']['input']>;
};

export type MetromChainInput = {
chainId: Scalars['BigDecimal']['input'];
};

export type MetromPool = {
apr: Scalars['BigDecimal']['output'];
apy: Scalars['BigDecimal']['output'];
chainId: Scalars['BigDecimal']['output'];
pool: Scalars['String']['output'];
};

export type MinePool = {
chain: Scalars['String']['output'];
/** creator */
Expand Down Expand Up @@ -12380,6 +12392,8 @@ export type Query = {
/** data url:post(https://host:port/manage/slippage_tolerance_list).data */
manage_slippage_tolerance_list?: Maybe<Array<Maybe<ManageSlippageTolerance>>>;
market_maker_pool_apply_create?: Maybe<Market_Maker_Pool_ApplyData>;
/** 获取Metrom的池子列表 */
metrom_getPools: Array<Maybe<MetromPool>>;
minePool?: Maybe<MinePool>;
minePools: Array<MinePool>;
miningPool?: Maybe<MiningPool>;
Expand Down Expand Up @@ -13756,6 +13770,10 @@ export type QueryMarket_Maker_Pool_Apply_CreateArgs = {
data?: InputMaybe<Market_Maker_Pool_ApplypoolApplyData>;
};

export type QueryMetrom_GetPoolsArgs = {
where?: InputMaybe<MetromChainInput>;
};

export type QueryMinePoolArgs = {
block?: InputMaybe<Block_Height>;
id: Scalars['ID']['input'];
Expand Down Expand Up @@ -20926,6 +20944,7 @@ export type FetchLiquidityListQuery = {
miningQuoteApy?: any | null;
transactionBaseApy?: any | null;
transactionQuoteApy?: any | null;
metromMiningApy?: any | null;
} | null;
} | null;
} | null> | null;
Expand Down Expand Up @@ -21002,6 +21021,7 @@ export type FetchMyLiquidityListQuery = {
miningQuoteApy?: any | null;
transactionBaseApy?: any | null;
transactionQuoteApy?: any | null;
metromMiningApy?: any | null;
} | null;
} | null;
} | null> | null;
Expand Down Expand Up @@ -21090,6 +21110,7 @@ export type FetchPoolQuery = {
miningQuoteApy?: any | null;
transactionBaseApy?: any | null;
transactionQuoteApy?: any | null;
metromMiningApy?: any | null;
} | null;
} | null;
} | null> | null;
Expand Down Expand Up @@ -21775,6 +21796,7 @@ export const FetchLiquidityListDocument = new TypedDocumentString(`
miningQuoteApy
transactionBaseApy
transactionQuoteApy
metromMiningApy
}
miningAddress
volume24H
Expand Down Expand Up @@ -21857,6 +21879,7 @@ export const FetchMyLiquidityListDocument = new TypedDocumentString(`
miningQuoteApy
transactionBaseApy
transactionQuoteApy
metromMiningApy
}
miningAddress
volume24H
Expand Down Expand Up @@ -21949,6 +21972,7 @@ export const FetchPoolDocument = new TypedDocumentString(`
miningQuoteApy
transactionBaseApy
transactionQuoteApy
metromMiningApy
}
miningAddress
}
Expand Down
3 changes: 3 additions & 0 deletions packages/dodoex-api/src/services/pool/graphqlQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const poolGraphqlQuery = {
miningQuoteApy
transactionBaseApy
transactionQuoteApy
metromMiningApy
}
miningAddress
volume24H
Expand Down Expand Up @@ -170,6 +171,7 @@ export const poolGraphqlQuery = {
miningQuoteApy
transactionBaseApy
transactionQuoteApy
metromMiningApy
}
miningAddress
volume24H
Expand Down Expand Up @@ -260,6 +262,7 @@ export const poolGraphqlQuery = {
miningQuoteApy
transactionBaseApy
transactionQuoteApy
metromMiningApy
}
miningAddress
}
Expand Down
4 changes: 2 additions & 2 deletions packages/dodoex-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dodoex/components",
"version": "3.0.1-beta.1",
"version": "3.0.2-neox.1",
"description": "UI component library",
"source": "src/index.ts",
"types": "dist/types/index.d.ts",
Expand Down Expand Up @@ -40,7 +40,7 @@
"license": "GPL-3.0-or-later",
"dependencies": {
"@babel/runtime": "^7.17.0",
"@dodoex/icons": "^2.0.1",
"@dodoex/icons": "^2.0.2",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@mui/base": "5.0.0-beta.58",
Expand Down
2 changes: 1 addition & 1 deletion packages/dodoex-widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"dependencies": {
"@babel/runtime": "^7.17.0",
"@dodoex/api": "3.0.3-neox.3",
"@dodoex/components": "3.0.1-beta.1",
"@dodoex/components": "3.0.2-neox.1",
"@dodoex/contract-request": "^1.3.0",
"@dodoex/dodo-contract-request": "^1.9.0-alpha.3",
"@dodoex/icons": "^2.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/dodoex-widgets/src/locales/en-US.po
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ msgid "Fresh Mining"
msgstr "Fresh Mining"

#: src/widgets/PoolWidget/PoolDetail/components/Overview.tsx:98
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:148
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:151
msgid "LP Fee"
msgstr "LP Fee"

Expand Down Expand Up @@ -1974,7 +1974,7 @@ msgid "The closer the provided asset ratio is to the recommended ratio ({recomme
msgstr "The closer the provided asset ratio is to the recommended ratio ({recommendRatioText}), the smaller the portion burned."

#: src/widgets/PoolWidget/PoolDetail/components/Overview.tsx:112
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:166
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:169
msgid "MT Fee"
msgstr "MT Fee"

Expand Down
4 changes: 2 additions & 2 deletions packages/dodoex-widgets/src/locales/zh-CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ msgid "Fresh Mining"
msgstr ""

#: src/widgets/PoolWidget/PoolDetail/components/Overview.tsx:98
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:148
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:151
msgid "LP Fee"
msgstr ""

Expand Down Expand Up @@ -1974,7 +1974,7 @@ msgid "The closer the provided asset ratio is to the recommended ratio ({recomme
msgstr ""

#: src/widgets/PoolWidget/PoolDetail/components/Overview.tsx:112
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:166
#: src/widgets/PoolWidget/PoolList/components/PoolApyTooltip.tsx:169
msgid "MT Fee"
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { ChainId, SUPPORTED_CHAINS, SupportedChainsType } from './chains';
type AddressMap = { [chainId: number]: string };

type ChainAddresses = {
/**
* UniswapV3Factory
* @see https://taikoscan.io/address/0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2?tab=contract#code
*/
v3CoreFactoryAddress: string;
/**
* NonfungiblePositionManager
* @see https://taikoscan.io/address/0x2623281DdcC34A73a9e8898f2c57A32A860903f1?tab=contract#code
*/
nonfungiblePositionManagerAddress?: string;
};

Expand All @@ -28,15 +36,20 @@ const SEPOLIA_ADDRESSES: ChainAddresses = {
'0x483E5c0f309577f79b0a19cE65E332DD388aD7A8',
};

const TAIKO_ADDRESSES: ChainAddresses = {
v3CoreFactoryAddress: '0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2',
nonfungiblePositionManagerAddress:
'0x2623281DdcC34A73a9e8898f2c57A32A860903f1',
};

export const CHAIN_TO_ADDRESSES_MAP: Record<
SupportedChainsType,
ChainAddresses
> = {
[ChainId.MAINNET]: MAINNET_ADDRESSES,
[ChainId.ARBITRUM_ONE]: ARBITRUM_ONE_ADDRESSES,
[ChainId.SEPOLIA]: SEPOLIA_ADDRESSES,
// TODO
[ChainId.TAIKO]: SEPOLIA_ADDRESSES,
[ChainId.TAIKO]: TAIKO_ADDRESSES,
};

/* V3 Contract Addresses */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { ChainId } from '../sdk-core';

export const FACTORY_ADDRESS = '0x1F98431c8aD98523631AE4a59f267346ea31F984';
/**
* Taiko UniswapV3Factory
* @see https://taikoscan.io/address/0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2?tab=contract#code
*/
export const FACTORY_ADDRESS = '0x78172691DD3B8ADa7aEbd9bFfB487FB11D735DB2';

export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000';

// @deprecated please use poolInitCodeHash(chainId: ChainId)
export const POOL_INIT_CODE_HASH =
'0x4509fa1e2d1989ac1632a56fe87c53e8d1e9d05847694e00f62b23e28cec98c4';
'0x5ccd5621c1bb9e44ce98cef8b90d31eb2423dec3793b6239232cefae976936ea';

/**
* Taiko POOL_INIT_CODE_HASH
* @see PoolAddress.sol
* @see https://taikoscan.io/address/0x202bEE65B164aEcBb6A2318438bf46bEF14E1072?tab=contract#code#F12#L6
*/
export function poolInitCodeHash(chainId?: ChainId): string {
switch (chainId) {
case ChainId.TAIKO:
return '0x5ccd5621c1bb9e44ce98cef8b90d31eb2423dec3793b6239232cefae976936ea';
default:
return POOL_INIT_CODE_HASH;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ function CardList({
)
: undefined;
const hasMining = !!item.miningAddress?.[0];
const hasMetromMining =
!!item.apy?.metromMiningApy && Number(item.apy?.metromMiningApy) > 0;

const type = item.type as PoolType;
const poolType = getPoolAMMOrPMM(type);
Expand Down Expand Up @@ -163,7 +165,7 @@ function CardList({
/>
</Box>
</Box>
{hasMining ? (
{hasMining || hasMetromMining ? (
<Box
sx={{
p: 8,
Expand Down Expand Up @@ -467,6 +469,9 @@ function TableList({
}

const hasMining = !!item.miningAddress?.[0];
const hasMetromMining =
!!item.apy?.metromMiningApy &&
Number(item.apy?.metromMiningApy) > 0;

const type = item.type as PoolType;
const poolType = getPoolAMMOrPMM(type);
Expand Down Expand Up @@ -643,7 +648,7 @@ function TableList({
backgroundColor: 'background.paper',
}}
>
{hasMining ? (
{hasMining || hasMetromMining ? (
<Tooltip title={t`Mining`}>
<Box
component="span"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ function CardList({
});
}
const hasMining = !!item.miningAddress?.[0];
const hasMetromMining =
!!item.apy?.metromMiningApy && Number(item.apy?.metromMiningApy) > 0;

const position = lq.liquidityPositions?.[0];

Expand Down Expand Up @@ -204,7 +206,7 @@ function CardList({
/>
</Box>
</Box>
{hasMining ? (
{hasMining || hasMetromMining ? (
<Box
sx={{
p: 8,
Expand Down Expand Up @@ -750,6 +752,9 @@ function TableList({
}
}
const hasMining = !!item.miningAddress?.[0];
const hasMetromMining =
!!item.apy?.metromMiningApy &&
Number(item.apy?.metromMiningApy) > 0;
const hoverBg = theme.palette.background.tag;

const mt = 6;
Expand Down Expand Up @@ -931,7 +936,7 @@ function TableList({
backgroundColor,
}}
>
{hasMining ? (
{hasMining || hasMetromMining ? (
<Tooltip title={t`Mining`}>
<Box
component="span"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function PoolApyTooltip({
transactionQuoteApy?: string | null;
miningBaseApy?: string | null;
miningQuoteApy?: string | null;
metromMiningApy?: string | null;
}
| undefined
| null;
Expand All @@ -40,6 +41,7 @@ export default function PoolApyTooltip({
token?: TokenInfo;
transactionApy?: string | null;
miningApy?: string | null;
metromMiningApy?: string | null;
}> = hasQuote
? [
{
Expand All @@ -57,6 +59,7 @@ export default function PoolApyTooltip({
{
transactionApy: apy?.transactionBaseApy,
miningApy: apy?.miningBaseApy,
metromMiningApy: apy?.metromMiningApy,
},
];
return (
Expand Down Expand Up @@ -174,6 +177,25 @@ export default function PoolApyTooltip({
) : (
''
)}
{item.metromMiningApy && Number(item.metromMiningApy) > 0 && (
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
typography: 'h6',
color: 'text.secondary',
}}
>
<span>
<Trans>Mining</Trans>
</span>
<span>
{item.metromMiningApy
? formatApy(new BigNumber(item.metromMiningApy))
: '-'}
</span>
</Box>
)}
</Box>
))}
</Box>
Expand Down

0 comments on commit 92d9bda

Please sign in to comment.