Description
In frontend/src/components/auction/BidForm.tsx (lines 22-26) and frontend/src/components/auction/AuctionCard.tsx (line ~60), there's an inconsistency in how floor_price and winning_bid are treated:
BidForm.tsx:
const floorXlm = stroopsToXlm(auction.floor_price); // Treats as stroops
const currentBidXlm = auction.winning_bid
? stroopsToXlm(auction.winning_bid) // Treats as stroops
: null;
AuctionCard.tsx:
BigInt(auction.floor_price) // Used directly as BigInt — unclear if stroops or XLM
BidForm submission (line ~75):
const amountStroops = Math.round(parseFloat(bidAmount) * 1e7); // Converts XLM input to stroops
Problem
If the contract returns floor_price in XLM (not stroops), then stroopsToXlm() divides by 1e7, making the floor price appear 10 million times smaller than intended. Conversely, if the contract returns stroops, the BigInt() usage in AuctionCard displays raw stroops to the user.
The same data field is handled differently in two components with no shared type definition or documentation of the expected unit.
Impact
- Bid floor prices could be displayed as effectively zero (if already in XLM but converted again)
- Users could place bids that are 10 million times too low or too high
- Real money (XLM) is at stake — wrong conversions mean lost funds
Suggested Fix
- Define a clear
Auction type with documented units:
interface Auction {
floor_price: bigint; // Always in stroops (1 XLM = 10,000,000 stroops)
winning_bid: bigint; // Always in stroops
}
- Use consistent conversion across all components
- Add unit tests for bid amount conversions
Files Affected
frontend/src/components/auction/BidForm.tsx
frontend/src/components/auction/AuctionCard.tsx
Description
In
frontend/src/components/auction/BidForm.tsx(lines 22-26) andfrontend/src/components/auction/AuctionCard.tsx(line ~60), there's an inconsistency in howfloor_priceandwinning_bidare treated:BidForm.tsx:
AuctionCard.tsx:
BidForm submission (line ~75):
Problem
If the contract returns
floor_pricein XLM (not stroops), thenstroopsToXlm()divides by1e7, making the floor price appear 10 million times smaller than intended. Conversely, if the contract returns stroops, theBigInt()usage inAuctionCarddisplays raw stroops to the user.The same data field is handled differently in two components with no shared type definition or documentation of the expected unit.
Impact
Suggested Fix
Auctiontype with documented units:Files Affected
frontend/src/components/auction/BidForm.tsxfrontend/src/components/auction/AuctionCard.tsx