Skip to content

Commit

Permalink
fix: fee change
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-path committed Nov 18, 2024
1 parent 3ceea36 commit f3b3439
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions screens/Trading/components/TradingOperate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,13 @@ const TradingOperate = () => {
}, [longOutput, shortOutput]);

const Fee = useMemo(() => {
console.log(ReduxcategoryAssets1, ReduxcategoryAssets2);
return {
fee: (Number(longInput || shortInput) * config.open_position_fee_rate) / 10000,
fee:
(Number(longInput || shortInput) * config.open_position_fee_rate) / 10000 +
(estimateData?.fee ?? 0) / 10000,
price: getAssetPrice(ReduxcategoryAssets1),
};
}, [longInput, shortInput, ReduxcategoryAssets1]);
}, [longInput, shortInput, ReduxcategoryAssets1, estimateData]);

function getAssetPrice(categoryId) {
return categoryId ? assets.data[categoryId["token_id"]].price?.usd : 0;
Expand Down Expand Up @@ -509,10 +510,10 @@ const TradingOperate = () => {
<div className="flex items-center justify-between text-sm mb-4">
<div className="text-gray-300">Fee</div>
<div className="flex items-center justify-center">
<p className="border-b border-dashed border-dark-800">{Fee.fee}</p>
<p className="border-b border-dashed border-dark-800">{Fee.fee.toFixed(6)}</p>
NEAR
<span className="text-xs text-gray-300 ml-1.5">
(${Fee.fee * (Fee.price || 0)})
(${(Fee.fee * (Fee.price || 0)).toFixed(6)})
</span>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion store/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export const shrinkToken = (
decimals: string | number,
fixed?: number,
): string => {
console.log(value, decimals, fixed, "......");
if (!value) return "";
return new Decimal(value).div(new Decimal(10).pow(decimals)).toFixed(fixed);
};
Expand Down

0 comments on commit f3b3439

Please sign in to comment.