Skip to content

Commit

Permalink
fix: fee percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
williamluke4 committed Mar 26, 2024
1 parent 63595cb commit 23879b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/swap/forms/swap-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@ export function SwapForm({
{/* Fee */}
<div className="flex justify-between text-gray-400">
<span>Fee</span>
<span>{Number(swapPool.feePpm) / 10000} %</span>
<span>{swapPool.feePercentage.toString()} %</span>
</div>
<div className="flex justify-between text-gray-400">
<span>Amount</span>
<span>
{(
Number(amount ?? "0") *
(Number(swapPool.feePpm) / 10000)
(swapPool.feePercentage / 100)
).toString() + ` ${fromToken?.symbol ?? ""}`}
</span>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/swap/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ export const useSwapPool = (address: `0x${string}`) => {
address,
tokenLimiter
);
const feePercentage = feePpm ? Number(feePpm) / 10000 : 0
return {
address: address,
feePercentage,
tokenIndex,
owner,
name,
Expand Down
7 changes: 1 addition & 6 deletions src/components/swap/swap-pool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ export const SwapPoolDetails = ({ address }: { address: `0x${string}` }) => {
<Row label="Owner" value={pool.owner ?? ""} />
<Row label="Quoter" value={pool.quoter ?? ""} />
<Row label="Fee Address" value={pool.feeAddress ?? ""} />
<Row
label="Fee"
value={
pool.feePpm ? (pool.feePpm / BigInt(1000)).toString() + " %" : ""
}
/>
<Row label="Fee" value={pool.feePercentage.toString() + " %"} />
<Row label="Limiter" value={pool.tokenLimiter ?? ""} />
</CardContent>
</Card>
Expand Down

0 comments on commit 23879b8

Please sign in to comment.