Skip to content

Commit

Permalink
Merge pull request #291 from ergolabs/hotfix/rm-ui-fee
Browse files Browse the repository at this point in the history
Reduce UI Fee
  • Loading branch information
yasha-black authored Jan 6, 2022
2 parents 0959794 + 16d7d90 commit 5ed2f57
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@craco/craco": "^6.3.0",
"@ergolabs/ergo-dex-sdk": "^1.2.1",
"@ergolabs/ergo-dex-sdk": "1.2.2",
"@ergolabs/ergo-sdk": "^0.1.16",
"@rehooks/local-storage": "2.4.0",
"@sentry/react": "^6.16.1",
Expand Down
4 changes: 1 addition & 3 deletions src/constants/erg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ export const ERG_TOKEN_NAME = 'ERG';
export const ERG_TOKEN_ID =
'0000000000000000000000000000000000000000000000000000000000000000';
export const DEFAULT_MINER_FEE = BigInt(2_000_000);
export const EXECUTION_MINER_FEE = BigInt(2_000_000);
export const ERG_DECIMALS = 9;

export const MIN_EX_FEE = BigInt(7_000_000);
export const MIN_NITRO = 1.2;
export const NITRO_DECIMALS = 2;

export const UI_FEE = 0.01;
export const UI_FEE = 0;
2 changes: 0 additions & 2 deletions src/constants/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export const SlippageMin = 0.1;
export const SlippageMax = 100;
export const SlippageDecimals = 2;

export const PoolFeeMin = 0;
export const PoolFeeMax = 0.25;
export const PoolFeeDecimals = 3;

export const UiRewardAddress =
'9gCigPc9cZNRhKgbgdmTkVxo1ZKgw79G8DvLjCcYWAvEF3XRUKy';
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const AddLiquidityConfirmationModal: React.FC<ConfirmRemoveModalProps> = ({

return (
<>
<Modal.Title>Confirm operation</Modal.Title>
<Modal.Title>Confirm Add Liquidity</Modal.Title>
<Modal.Content width={436}>
<Flex direction="col">
<Flex.Item marginBottom={6}>
Expand All @@ -110,25 +110,29 @@ const AddLiquidityConfirmationModal: React.FC<ConfirmRemoveModalProps> = ({
<InfoTooltip
placement="rightBottom"
content={
<Flex direction="col" style={{ width: '200px' }}>
<Flex direction="col">
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>Miner Fee:</Flex.Item>
<Flex>
<Flex.Item marginRight={1}>Miner Fee:</Flex.Item>
<Flex.Item>{minerFee} ERG</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>Execution Fee:</Flex.Item>
<Flex>
<Flex.Item marginRight={1}>
Execution Fee:
</Flex.Item>
<Flex.Item>{defaultExFee} ERG</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>UI Fee:</Flex.Item>
<Flex.Item>{UI_FEE} ERG</Flex.Item>
</Flex>
</Flex.Item>
{!!UI_FEE && (
<Flex.Item>
<Flex>
<Flex.Item marginRight={1}>UI Fee:</Flex.Item>
<Flex.Item>{UI_FEE} ERG</Flex.Item>
</Flex>
</Flex.Item>
)}
</Flex>
}
/>
Expand All @@ -147,7 +151,7 @@ const AddLiquidityConfirmationModal: React.FC<ConfirmRemoveModalProps> = ({
size="extra-large"
onClick={() => addLiquidityOperation()}
>
Add
Add Liquidity
</Button>
</Flex.Item>
</Flex>
Expand Down
32 changes: 19 additions & 13 deletions src/pages/Remove/ConfirmRemoveModal/ConfirmRemoveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const ConfirmRemoveModal: React.FC<ConfirmRemoveModalProps> = ({

return (
<>
<Modal.Title>Confirm operation</Modal.Title>
<Modal.Title>Confirm Remove Liquidity</Modal.Title>
<Modal.Content width={436}>
<Box transparent>
<Flex direction="col">
Expand All @@ -123,25 +123,31 @@ const ConfirmRemoveModal: React.FC<ConfirmRemoveModalProps> = ({
<InfoTooltip
placement="rightBottom"
content={
<Flex direction="col" style={{ width: '200px' }}>
<Flex direction="col">
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>Miner Fee:</Flex.Item>
<Flex>
<Flex.Item marginRight={1}>
Miner Fee:
</Flex.Item>
<Flex.Item>{minerFee} ERG</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>Execution Fee:</Flex.Item>
<Flex>
<Flex.Item marginRight={1}>
Execution Fee:
</Flex.Item>
<Flex.Item>{defaultExFee} ERG</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>UI Fee:</Flex.Item>
<Flex.Item>{UI_FEE} ERG</Flex.Item>
</Flex>
</Flex.Item>
{!!UI_FEE && (
<Flex.Item>
<Flex>
<Flex.Item marginRight={1}>UI Fee:</Flex.Item>
<Flex.Item>{UI_FEE} ERG</Flex.Item>
</Flex>
</Flex.Item>
)}
</Flex>
}
/>
Expand All @@ -160,7 +166,7 @@ const ConfirmRemoveModal: React.FC<ConfirmRemoveModalProps> = ({
size="large"
onClick={() => removeOperation(position)}
>
Remove liquidity
Remove Liquidity
</Button>
</Flex.Item>
</Flex>
Expand Down
44 changes: 20 additions & 24 deletions src/pages/Swap/SwapConfirmationModal/SwapConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@ export const SwapConfirmationModal: FC<SwapConfirmationModalProps> = ({
}
}, [baseParams, exFeeNErg, nitro, minerFee]);

// const { baseInput, baseInputAmount, minOutput } = getBaseInputParameters(
// value.pool,
// {
// inputAmount,
// inputAsset,
// slippage,
// },
// );

// const exFeePerToken = vars[0];
// const { maxExFee, minOutput } = vars[1];

const swapOperation = async () => {
if (
poolFeeNum &&
Expand Down Expand Up @@ -252,22 +240,30 @@ export const SwapConfirmationModal: FC<SwapConfirmationModalProps> = ({
<InfoTooltip
placement="right"
content={
<Flex direction="col" style={{ width: '250px' }}>
<Flex direction="col">
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>Miner Fee:</Flex.Item>
<Flex>
<Flex.Item marginRight={1}>
Miner Fee:
</Flex.Item>
<Flex.Item>{minerFee} ERG</Flex.Item>
</Flex>
</Flex.Item>
{!!UI_FEE && (
<Flex.Item>
<Flex>
<Flex.Item marginRight={1}>
UI Fee:
</Flex.Item>
<Flex.Item>{UI_FEE} ERG</Flex.Item>
</Flex>
</Flex.Item>
)}
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>UI Fee:</Flex.Item>
<Flex.Item>{UI_FEE} ERG</Flex.Item>
</Flex>
</Flex.Item>
<Flex.Item>
<Flex justify="space-between">
<Flex.Item>Execution Fee:</Flex.Item>
<Flex>
<Flex.Item marginRight={1}>
Execution Fee:
</Flex.Item>
<Flex.Item>
{operationVars &&
`${renderFractions(
Expand Down Expand Up @@ -299,7 +295,7 @@ export const SwapConfirmationModal: FC<SwapConfirmationModalProps> = ({
</Flex.Item>
<Flex.Item>
<Button size="extra-large" type="primary" htmlType="submit" block>
Confirm swap
Confirm Swap
</Button>
</Flex.Item>
</Flex>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1642,10 +1642,10 @@
ts-node "^9"
tslib "^2"

"@ergolabs/ergo-dex-sdk@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@ergolabs/ergo-dex-sdk/-/ergo-dex-sdk-1.2.1.tgz#9dfbcaa49cc95c4daca12dde7f250f29303d4b26"
integrity sha512-dOR+wjxv/Cjxy2mP4GUjwikoIGTwKxroKWH3MWxFyTIPxCr42LLmJvXx8gj7SQHC4uIj8Uib6UBSyUjzm+LiVQ==
"@ergolabs/[email protected].2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@ergolabs/ergo-dex-sdk/-/ergo-dex-sdk-1.2.2.tgz#90490fdd48379ab7549bdb36f3c6588391e9f29c"
integrity sha512-RBOWnlJe7GIlWyQoytsy3LDVJ2zTl+KUtLhcP2Ep+yJAM83MW3151mX2Lz5np8RMEsua/hlwFMzxNCJJ445GGA==
dependencies:
"@ergolabs/ergo-sdk" "0.1.16"
axios "^0.21.1"
Expand Down

0 comments on commit 5ed2f57

Please sign in to comment.