Skip to content

Commit

Permalink
add dao fee to pool display
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridel1e committed Feb 23, 2024
1 parent d40d2cc commit ce25de3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/network/cardano/api/ammPools/CardanoAmmPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export class CardanoAmmPool extends AmmPool {
return this.pool.poolFeeNum;
}

get treasuryFeeNum(): bigint | undefined {
return this.pool.treasuryFee || undefined;
}

get tvl(): Currency | undefined {
return this.metrics?.tvlAda
? new Currency(
Expand Down
3 changes: 2 additions & 1 deletion src/network/cardano/api/ammPools/analyticPoolNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface AmmPoolDescriptor {
};
readonly poolFeeNumX: number;
readonly poolFeeNumY: number;
readonly treasuryFee: 1;
readonly treasuryFee: number;
readonly treasuryX: string;
readonly treasuryY: string;
readonly verified: true;
Expand Down Expand Up @@ -119,6 +119,7 @@ export class AnalyticPoolNetwork {
: AmmPoolType.DEFAULT,
BigInt(rawAmmPool.pool.treasuryX || '0'),
BigInt(rawAmmPool.pool.treasuryY || '0'),
BigInt(rawAmmPool.pool.treasuryFee || '0'),
),
metrics: rawAmmPool.metrics,
};
Expand Down
4 changes: 4 additions & 0 deletions src/network/ergo/api/ammPools/ErgoAmmPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export class ErgoAmmPool extends AmmPool {
return this.pool.feeDenom;
}

get treasuryFeeNum(): bigint | undefined {
return undefined;
}

get feeDecimalsCount(): bigint {
return 1n;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, useDevice } from '@ergolabs/ui-kit';
import { BankOutlined, Flex, Tooltip, useDevice } from '@ergolabs/ui-kit';

Check failure on line 1 in src/pages/Liquidity/common/columns/PoolsOrPositionsColumns/columns/PairColumn/PairColumn.tsx

View workflow job for this annotation

GitHub Actions / Build Artifacts

Property 'treasuryFee' does not exist on type 'AmmPool'.

Check failure on line 1 in src/pages/Liquidity/common/columns/PoolsOrPositionsColumns/columns/PairColumn/PairColumn.tsx

View workflow job for this annotation

GitHub Actions / Build Artifacts

Property 'treasuryFee' does not exist on type 'AmmPool'.
import { FC, MouseEvent } from 'react';
import { useNavigate } from 'react-router-dom';

Expand Down Expand Up @@ -39,9 +39,29 @@ export const PairColumn: FC<PairColumnProps> = ({ ammPool }) => {
isShowDivider={!s}
/>
</Flex.Item>
<Flex.Item marginLeft={2} marginRight={3}>
<Flex.Item marginLeft={2} marginRight={2}>
<DataTag content={`${ammPool.poolFee}%`} />
</Flex.Item>
{ammPool.treasuryFee && (
<Flex.Item marginRight={2}>
<DataTag
content={
<Tooltip
placement="top"
title="The fee charged by the DAO"
width="200"
>
<Flex align="center">
<Flex.Item marginRight={1}>
<BankOutlined size={16} />
</Flex.Item>
{`${ammPool.treasuryFee}%`}
</Flex>
</Tooltip>
}
/>
</Flex.Item>
)}
{/*TODO: IGNORE FOR CARDANO*/}
<IsErgo>
{hasFarmForPool && <FarmsButton onClick={handleFarmsButtonClick} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const PoolsOrPositionsTableView: FC<
tableItemViewPadding={[0, 4]}
>
<TableView.Column
width={401}
headerWidth={393}
width={451}
headerWidth={443}
title={<Trans>Pair</Trans>}
>
{(ammPool) => <PairColumn ammPool={poolMapper(ammPool)} />}
Expand Down

0 comments on commit ce25de3

Please sign in to comment.