We have detected that you are using AdBlock.

Please disable it for this site to continue.

Bicrypto - Crypto Trading Platform, Exchanges, KYC, Charting Library, Wallets, Binary Trading, News

Bicrypto - Crypto Trading Platform, Exchanges, KYC, Charting Library, Wallets, Binary Trading, News v6.3.9 + Addons Nulled

V6.3.9
Overview

Version 6.3.9 is the page-builder release. A full audit of /admin/builder turned up ninety-plus findings ranging from silent data loss on every undo, to multiple stored-XSS vectors, to a template library where most of the "premium" catalog was empty stubs. This release closes all of them in one pass and rebuilds the template library from scratch.

Headline changes:

Undo no longer wipes your page. Every structural undo used to silently empty the page. Fixed.
250 new premium templates across 25 categories — universal structure, universal content, and dedicated showcases for each active extension (trading, forex/futures, copy-trading, NFT, staking, ICO, P2P, e-commerce, affiliate, AI).
Edit mode now renders at preview parity. Gradients, buttons, alignment, column heights, inline layout — edit and preview now agree pixel-for-pixel on what the page looks like.
XSS hardening across every renderer that emitted HTML, plus a security pass on the admin page-content API.

Update Instructions

After updating, run the following command in terminal:
bash

pnpm updator

No environment variables are required. No database migration is needed.
Critical data-loss fix
Undo no longer empties the page

The structural-action history path (row / column / section adds, moves, reorders, resizes — twelve actions in total) was encoding each inverse patch as "current page → empty page". The first undo on any of those actions quietly reset sections[] and elements[] to empty arrays. Users lost work on every Ctrl+Z that followed a structural change.

All twelve structural actions now share the same patch logic the element actions use — createHistoryEntryFromChange(prev, next, label) — so an undo restores exactly the state before the change. The future[] stack is now cleared uniformly on every new action, the history is capped at 100 entries so long sessions don't grow unbounded, and deepClone no longer short-circuits into an alias (a prior bug where produce(obj, () => {}) was returning the same reference, silently making cloned state point at the live state).

Ancillary store cleanups that rode along:

selectElement / selectRow / selectColumn now actually use their parent-context arguments (previously ignored, so ancestor selection was always null).
The 10 ms setTimeout race in addElement that deferred selection to the next tick is gone.
The dead historyIndex field that was written by half the actions and read by none has been removed from the type.

Stored-XSS hardening
Every dangerouslySetInnerHTML call-site is now sanitized

Eight render paths (Heading, Text, List, Quote, Link, Button, EditableContent, and the AI-generated section preview) were injecting admin-authored HTML into the public site without any sanitization. A new wrapper component running DOMPurify now mediates every one of them. The cursor-jump bug in contenteditable inline-edit (where the innerHTML was being rewritten on every parent tick) was fixed at the same time.

Related hardening:

rel="noopener noreferrer" is now set on every external link and , and every window.open(url, "_blank") gets the "noopener,noreferrer" third argument to prevent tabnabbing.
htmlId / cssClasses editor fields were writing to one key name while the renderer was reading another — aligned. Classes now store as space-separated strings.

Admin page-content API

Public list and detail endpoints now filter status: "PUBLISHED" and no longer leak DRAFT content to anonymous visitors.
PUT /api/admin/content/page/:id returns the full record (previously returned { message }, which the frontend was then storing in its page-metadata state — silently corrupting local state on every save).
The public list response now excludes content, customCss, customJs, and settings (rows of content up to 16 MB each used to ship in the list payload).
Public caches are invalidated on every admin write (previously a 12 h stale window after any edit).
isHome uniqueness is enforced inside a transaction with lock: true — the prior race window between the demote-everyone-else and promote-this-one writes is closed.
visits and lastModifiedBy are now stripped from the writable schema; lastModifiedBy is always set server-side from the authenticated admin rather than a hardcoded literal.
Reserved slugs (admin, api, etc.) are rejected.

Template library rebuild — 250 premium templates

The old template directory was a mix of thirty rich files and nineteen stubs that rendered as empty sections. It has been deleted in its entirety. The new library:
25 categories × 10 templates

Universal structure (80): Header · Hero · Features · CTA · Pricing · Testimonials · Stats · Footer.

Universal content (70): About · Team · Contact · FAQ · Logo Cloud · Newsletter · Blog.

Extension showcases (100): Trading · Forex & Futures · Copy Trading · NFT · Staking · ICO Launchpad · P2P · E-commerce · Affiliate · AI Features. Each extension category contains ten premium sections specifically tailored to that extension — e.g. the NFT category has a collection-hero banner, trending-now scroll, mint-countdown hero, creator-spotlight, rarity showcase, activity feed preview, and so on; the ICO category has upcoming-sales grid, active-sale countdown, tokenomics breakdown, KYC process steps, etc.
Shared design foundation

Every template is composed from a small set of typed factories:

el.heading / el.text / el.button / el.image / el.icon / el.divider / el.spacer / el.list / el.card / el.link / el.quote.
col(width, children, settings) and row(columns, settings) helpers.
section(rows, opts) factory with a stable slug id.
Premium theme tokens — theme.primary, theme.bgBase, theme.textMuted, etc. — in both light and dark variants so every section is theme-aware by default.
Gradient presets (indigoViolet, skyEmerald, amberRose, nightSky, aurora) with both light and dark stops.
Section padding presets (hero, standard, compact, bar) and row presets (contained, wide, narrow).

freshenIds on every insert

Template ids are stable slugs for bookkeeping, but every nested row / column / element id is regenerated when a template is dropped into the canvas via the Add Section modal. Inserting the same template twice into one page no longer collides ids.
Real previews in the selector

The Add Section modal tiles now render real previews of each template via the existing SectionSnapshot + html-to-image pipeline instead of the prior solid-color placeholder. Tiles produce the actual pixels you'll get when you insert the section.
Category selector

25 categories with proper metadata (label, description, Iconify icon, extension hint).
Per-category search filter now actually filters (the previous implementation declared searchTerm in its useMemo deps but never applied it to the result — so typing in the search box did nothing).

Render parity — edit mode now matches preview

A batch of rendering fixes closed the gap between what the canvas showed during editing and what the preview rendered.
Gradients with hex stops now actually paint

Templates using gradients with raw hex stops (from: "#6366f1", to: "#ec4899") were emitting invalid Tailwind classes like from-#6366f1 which Tailwind then purged — resulting in black backgrounds where a gradient was intended. A new gradientToCss() helper detects hex / rgb / hsl stops and emits inline CSS linear-gradient(...) instead. Tailwind color-name gradients (from-indigo-500) still use the class-based path for purge compatibility.
Buttons now honor ColorValue objects

ButtonSettings.backgroundColor and color were typed as plain strings but every template passed { light, dark } theme objects. JS coerced those to the literal string "[object Object]" and the browser ignored them — so every premium button rendered as an unstyled purple default. The button renderer now accepts strings, theme objects, and gradients; it resolves each to the current theme at render time. Size presets (sm / md / lg) were wired up so size: "lg" produces a 48 px button with real padding instead of the tiny default.
Inline layout for links and icons

Multiple elements stacked inside one column were rendering vertically in edit mode, producing the "nav links stacked one per line" bug visible in header templates. The canvas already had inline-grouping logic — consecutive elements with display: "inline-block" flow horizontally — but el.link and el.icon factories weren't setting it. They now default to display: "inline-block", so nav links render horizontally out of the box while footer link columns keep their explicit display: "block" override.
Inline-group alignment synced between canvas and preview

The canvas hardcoded justify-center for its inline-group wrapper while the section-renderer read textAlign from the first element — so the same template showed differently in edit vs preview. Both paths now share the same precedence:

1Column-level justifyContent (explicit override).
2Column-level textAlign (center / right / left / justify / around).
3First inline element's textAlign.
4Default flex-start.

Supported mappings include justify/between → space-between and around → space-around so headers and footers can spread nav items properly when desired.
Inline group wraps a lone button

The canvas only wrapped two or more inline-capable elements in its flex container. A lone button fell through to block rendering and ignored textAlign: "right" on its column — so a single "Get started" CTA left-aligned in edit mode while the preview correctly right-aligned it via its own inline-group code. Both paths now wrap every inline element regardless of count.
Edit-mode overlays no longer push content

The orange / blue / green section / row / column selection and hover rings were implemented with regular CSS borders, which take layout space (1–2 px per side). They were replaced with outline: ... -outline-offset-2 so they sit inside the content box and don't shift siblings. Removed one extra wrapper
and one inner
layer that existed on the edit path but not in the renderer — these were introducing subtle height and flex differences.

Section container width aligned

The canvas section wrapper now applies getSectionContainerClass(section.type) (regular → max-w-6xl mx-auto px-4, specialty → max-w-7xl, fullwidth → w-full) matching the SectionRenderer used by preview exactly. This was the main reason edit and preview widths differed on non-fullwidth sections.
Forced column min-height removed

Every non-empty column in the canvas was getting min-h-[100px] applied unconditionally, forcing nav bars to render at 100 px even when their content only needed 60. Preview (which used natural content height) differed visibly. Non-empty columns now render at their content height; empty columns keep an 80 px minimum just so the "Add Content" affordance stays clickable.
Button clicks select instead of being swallowed

Clicking a button in edit mode did nothing — the button's click handler called e.stopPropagation() which blocked the click from reaching the outer Element wrapper that opens the settings panel. It now only preventDefaults (to block link navigation) and lets the event bubble so the wrapper's selectElement fires.
Settings panel and UX polish
Panel title spacing

The right-sidebar header rendered ColumnSettings / RowSettings / SectionSettings with no space between the element type and the word "Settings". Fixed — now reads "Column Settings", "Row Settings", "Section Settings".
Gradient-conflict alert text spacing

The Appearance editor's alert that appears when a gradient is already applied to one color property rendered as:

> A gradient is currently applied toBackground ColorYou can only apply gradients…

Now reads properly with spaces and a period:

> A gradient is currently applied to Background Color. You can only apply gradients…
Content tab hidden for structure selections

Selecting a section, row, or column used to show all three tabs — Content / Design / Advanced — but the Content tab just read "Select an element to edit its structure" since structure types have no content UI. Structure selections now show only Design · Advanced, with design defaulting. Element selections still show all three tabs.
No auto-selection on template insert

Inserting a section template via the Add Section modal used to auto-select the section, auto-open the settings panel, and flash all the edit overlays on. It now drops the section in silently — the canvas stays clean and the user selects deliberately.
Click empty canvas to deselect

Clicking anywhere on the dark gray margin around the canvas, or on empty space within the canvas itself, now clears every selection (element / column / row / section) and closes the settings panel. The prior implementation attached the handler only to one inner div and passed empty strings "" instead of null when clearing, which the isSettingsPanelOpen: id !== null check read as "still selected" — so clicking empty space did nothing. The handler is now attached to the three canvas wrapper layers (dark outer, centering wrapper, white canvas) and properly passes null to deselect. Clicks inside the right sidebar settings panel are unaffected, so editing values keeps the current selection intact.
Gallery element fixed

The gallery settings file opened with a stray escaped directive ("\"use client";) which broke the settings panel entirely when a gallery element was selected. Fixed. Unused enum members columns and container (renderer stubs with no editor and no template) were removed from ElementType to prevent accidental creation.
Keyboard hook hardened

The global Ctrl+Z / Ctrl+Y listener now checks contenteditable and skips when the user is inline-editing text (previously it hijacked the browser's native editor undo stack in contenteditable regions). The listener binds once on mount instead of rebinding on every store change.
AI section generator

The "Generate" prompt textarea was being reset to the literal string "untitled" after each generation cycle (copy-paste bug). It now resets to empty. The "Thumbs up / Needs work" feedback buttons in the generated-section preview were decorative — they now record the feedback and show a confirmation toast.
Modal backdrop hardening

The shared Modal component was closing on any mousedown outside the dialog, which meant dragging a text selection out of the modal would dismiss it mid-drag. Close now requires mousedown AND mouseup to land on the backdrop. Scroll-lock restore also now preserves the previous body.overflow value instead of hard-coding "auto".
Update Notes - Core 5.6.3

Fixed

Ecosystem Order Matching

• Partial Fill Fees: Fixed sellers being charged full order fee instead of proportional fee on partial fills - now correctly charges only for the filled amount


• Locked Funds Release: Fixed buyer's funds staying locked forever on partial fills - proportional cost and fee now properly released from locked balance


• Negative Balance: Fixed trade balance going negative due to wallet data type conversion issues - now explicitly converts Decimal types to numbers for accurate arithmetic


• Price Execution: Fixed unfair price matching where buyers always got their price - now properly uses maker's price (whoever placed order first)


• Unauthorized Credit: Fixed orders executing even when wallet updates failed due to insufficient funds - matching now properly aborts when validation fails


• Error Handling: Fixed order matching continuing after wallet update errors - failed matches are now skipped and orders remain available for retry


• Order Cancellation: Fixed partial fill cancellation refunding incorrect amounts - users receiving more than they should when cancelling partially filled orders - now correctly refunds only the remaining unfilled portion

Email Notifications

• Email Verification: Fixed email verification and deposit confirmation emails not being sent - added missing URL shortcode to template validation

Trading Interface

• Balance Display: Fixed trading page showing only available balance instead of total balance - now displays total balance, locked amount, and available balance separately for better clarity


• Chart Updates: Fixed OHLCV (candlestick) data not broadcasting to WebSocket subscribers when orders are matched - corrected subscription filter property order to match frontend subscription format

Improved

Fee Model

• Maker/Taker Fees: Improved fee assignment to use industry-standard maker/taker model


• Market orders now use taker fee (removes liquidity)


• Limit orders that cross spread use taker fee (removes liquidity)


• Limit orders that rest on book use maker fee (adds liquidity)


• Previous behavior incorrectly assigned fees based on buy/sell side only

Order Matching

• Proportional Fees: Enhanced fee calculations to properly handle partial fills


• 10% order fill now charges 10% of the fee (was charging 100% before)


• Locked funds released proportionally including fee portion


• All calculations maintain 18 decimal precision for accuracy

Wallet Operations

• Balance Integrity: Improved wallet update logic to prevent balance discrepancies


• Fresh wallet data fetched before each update to prevent stale data bugs


• Separate handling for order creation/cancellation vs order matching


• Both balance and locked funds (inOrder) validated before updates

Balance Display

• Wallet Information: Enhanced wallet endpoint to return comprehensive balance details


• Total balance (balance + inOrder)


• Amount locked in orders (inOrder)


• Available/spendable balance


• Trading Interface: Improved balance display with clear breakdown of all balance components


• Shows total owned balance prominently


• Displays locked funds with lock icon when applicable


• Highlights available balance in green for easy identification

Added

Trading Features

• Maker/Taker Detection: Added automatic detection of maker/taker status at order creation


• System checks if limit order will immediately match (taker) or rest on book (maker)


• Applies appropriate fee rate based on liquidity provision


• Encourages market depth with lower maker fees
Update Notes
Core 5.6.2 - Latest updates and improvements.

**Tags:** ECOSYSTEM TRADING, WEBSOCKET, ORDER MANAGEMENT, UI IMPROVEMENTS, REAL-TIME UPDATES

## Fixed

### Ecosystem Order Management

- **Order Cancellation Timestamp**: Fixed "Invalid date" error when canceling ecosystem orders - now correctly passes order's createdAt timestamp instead of Date.now()
- **Balance Updates**: Fixed spendable balance not updating in real-time after order cancellation - now broadcasts wallet update events
- **100% Orders**: Fixed 100% order placement failing due to fee not being subtracted from available balance
- **Sell Orders**: Fixed 100% SELL orders failing with "insufficient balance" error - now correctly calculates spendable balance (balance - inOrder)
- **Negative Balance**: Fixed asset balance going negative due to double-locking when creating orders - now properly uses spendable balance calculations
- **Amount Field Bug**: Fixed "untitled" text appearing in amount field after order submission - changed to empty string

### WebSocket Improvements

- **Orders WebSocket**: Created dedicated orders WebSocket service (`orders-ws.ts`) separate from market data WebSocket to prevent message routing conflicts
- **Connection IDs**: Fixed WebSocket messages being sent to wrong connections by using unique connection IDs (`orders-eco`, `orders-spot`, `orders-futures`)
- **Persistent Connection**: Moved orders WebSocket initialization to trading-layout level so connection stays alive even when orders panel is collapsed
- **Message Routing**: Fixed notifications and announcements being sent to all WebSocket connections - now only sent to `/api/user` connection using `sendToClientOnRoute()`
- **Partial Fills**: Fixed partial fills not appearing in real-time - now broadcasts order updates after each match in matchmaking

### Market Panel

- **isEco Flag**: Fixed eco market flag being lost when ticker data updates - now preserves all original market properties using spread operator pattern
- **Property Preservation**: Changed market update pattern from manual reconstruction to spread operator (`{...market, ...tickerUpdates}`) to prevent losing properties

## Improved

### Trading Interface

- **Fee Calculations**: Enhanced all order forms (limit, market, stop) to properly calculate fees for 100% orders
- BUY orders: `amount = availableBalance / (price * (1 + takerFee))`
- SELL orders: Use full balance (fee deducted from proceeds)
- **Fee Display**: Added trading fee display in order form UI showing fee percentage and estimated fee amount
- **Amount Precision**: Improved amount calculations using `Math.floor()` for proper rounding instead of hardcoded buffers

### Orders Panel - Fill Progress

- **Filled/Amount Display**: Enhanced Open Orders table to show "Filled / Amount" instead of just "Amount"
- **Visual Progress Bar**: Added color-coded progress bar (green for BUY, red for SELL) showing fill percentage
- **Real-time Updates**: Partial fills now update instantly via WebSocket without page reload
- **Compact Layout**: Optimized column width with `min-w-[120px]` for better space utilization
- **Percentage Indicator**: Shows fill percentage (e.g., "2%") next to progress bar for instant clarity

### Fee Handling

- **Taker/Maker Fees**: Properly passes market-specific taker and maker fees from market metadata to order forms
- **Dynamic Fee Rates**: Fees are now pulled from market configuration instead of being hardcoded
- **Fee Transparency**: Users can see exact fee amount before placing orders

## Added

### WebSocket Architecture

- **Orders WebSocket Service**: New dedicated service (`/services/orders-ws.ts`) for handling order updates
- Supports multiple market types (spot, eco, futures)
- Connection status tracking per market type
- Automatic reconnection handling
- Message caching for late subscribers
- **Message Broker Improvements**: Enhanced `sendToClientOnRoute()` method for route-specific WebSocket messaging

### Real-time Order Updates

- **Partial Fill Broadcasting**: Orders now broadcast updates after each match in the matching engine
- **Live Progress**: Users see their orders getting filled in real-time with visual progress indicators
- **Multi-user Updates**: Both buyer and seller receive instant updates when orders partially fill

## Technical Improvements

### Code Quality

- **Removed Debug Logs**: Cleaned up verbose console logging from production code:
- Ecosystem orders API logs
- Scylla query execution logs
- Orders WebSocket connection logs
- Trading layout initialization logs
- **Better Error Handling**: Kept only essential error logging for debugging real issues

### WebSocket Performance

- **Connection Management**: Single persistent connection per market type at layout level
- **Efficient Callbacks**: Panels register/unregister callbacks without affecting connection
- **No Duplicate Messages**: Fixed duplicate order broadcasts in matching engine

### Balance Calculations

- **Spendable Balance**: Wallet endpoint now returns `balance - inOrder` for accurate available balance
- **Order Validation**: Pre-flight checks use spendable balance to prevent insufficient balance errors
  • Like
Reactions: gideonite
# Update Notes 5.6

Update Notes
Menu translation added

docs\MENU-TRANSLATION-IMPLEMENTATION.md
Important Note

• Before updating: Delete /frontend/middleware.ts if present to avoid build conflicts

Fixed

Trading Page - Ecosystem Markets

• Order Cancellation: Fixed "Failed to cancel order" error for Eco markets


• Batch Cancellation: Fixed "Failed to cancel all orders" error for Eco markets


• Order History: Fixed cancelled orders now appearing immediately in History tab without page reload


• Open Orders Display: Fixed new orders requiring page reload to appear in Open Orders tab - orders now appear instantly


• Order Book Prices: Fixed prices showing as 0.000000 for values below 0.01 (e.g., 0.001 now displays correctly)


• Total Calculations: Fixed Total column showing 0.00 for small price calculations

Payment Methods

• QR Code Support: Fixed QR Code option not appearing in Type dropdown when creating new deposit methods

Investment Management

• Duration Selection: Fixed duration saving error in AI Investment and Forex plans


• Menu Visibility: Fixed Investment Management section not appearing in Finance menu

Forex Trading

• Account Type Display: Fixed Forex account MT version always showing MT4 instead of selected MT5

Build System

⚠️ IMPORTANT: Before running pnpm updator, manually delete /frontend/middleware.ts file if it exists


• Next.js 16 Compatibility: Cleared middleware/proxy conflict causing build errors

Improved

Order Book Enhancements

• Amount Display: Improved amount column formatting to strip trailing zeros (e.g., 1.00000000 displays as "1")


• Price Grouping: Improved order book grouping with fine-grained aggregation levels supporting micro-cap tokens


• Aggregation Options: Expanded aggregation dropdown from 4 to 8 options for better flexibility


• Decimal Precision: Enhanced aggregation algorithm for floating-point precision

Trading Interface

• Smart Price Formatting: Prices now display with appropriate decimal places based on value magnitude


• Real-time Updates: Orders now appear instantly via WebSocket without requiring page refresh


• Better Precision: Support for micro-priced assets and meme coins with tiny prices

Added

Investment Features

• Duration Selection: Added multiselect duration field to AI Investment plans


• Forex Durations: Added multiselect duration field to Forex plans


• Multiple Durations: Investment and Forex plans can now select multiple durations when creating or editing

Payment Methods

• QR Code Fields: Added QR Code option to deposit method custom fields in Type dropdown
# Update Notes 5.5.9

Update Notes
Important Note

• Before updating: Delete /frontend/middleware.ts if present to avoid build conflicts

Fixed

Trading Page - Ecosystem Markets

• Order Cancellation: Fixed "Failed to cancel order" error for Eco markets


• Batch Cancellation: Fixed "Failed to cancel all orders" error for Eco markets


• Order History: Fixed cancelled orders now appearing immediately in History tab without page reload


• Open Orders Display: Fixed new orders requiring page reload to appear in Open Orders tab - orders now appear instantly


• Order Book Prices: Fixed prices showing as 0.000000 for values below 0.01 (e.g., 0.001 now displays correctly)


• Total Calculations: Fixed Total column showing 0.00 for small price calculations

Payment Methods

• QR Code Support: Fixed QR Code option not appearing in Type dropdown when creating new deposit methods

Investment Management

• Duration Selection: Fixed duration saving error in AI Investment and Forex plans


• Menu Visibility: Fixed Investment Management section not appearing in Finance menu

Forex Trading

• Account Type Display: Fixed Forex account MT version always showing MT4 instead of selected MT5

Build System

⚠️ IMPORTANT: Before running pnpm updator, manually delete /frontend/middleware.ts file if it exists


• Next.js 16 Compatibility: Cleared middleware/proxy conflict causing build errors

Improved

Order Book Enhancements

• Amount Display: Improved amount column formatting to strip trailing zeros (e.g., 1.00000000 displays as "1")


• Price Grouping: Improved order book grouping with fine-grained aggregation levels supporting micro-cap tokens


• Aggregation Options: Expanded aggregation dropdown from 4 to 8 options for better flexibility


• Decimal Precision: Enhanced aggregation algorithm for floating-point precision

Trading Interface

• Smart Price Formatting: Prices now display with appropriate decimal places based on value magnitude


• Real-time Updates: Orders now appear instantly via WebSocket without requiring page refresh


• Better Precision: Support for micro-priced assets and meme coins with tiny prices

Added

Investment Features

• Duration Selection: Added multiselect duration field to AI Investment plans


• Forex Durations: Added multiselect duration field to Forex plans


• Multiple Durations: Investment and Forex plans can now select multiple durations when creating or editing

Payment Methods

• QR Code Fields: Added QR Code option to deposit method custom fields in Type dropdown

Critical Fixes

Withdrawal Balance Calculation

  • Fixed NATIVE EVM token withdrawal fee calculation - Gas fees are now correctly paid FROM the withdrawal amount instead of being added on top
  • Affected chains: ETH, BSC, POLYGON, FTM, OPTIMISM, ARBITRUM, BASE, CELO, RSK, AVAX
  • Previously: totalToDeduct = withdrawAmount + platformFee + gasFee (incorrect)
  • Now: totalToDeduct = withdrawAmount + platformFee (gas paid from withdrawal itself)

Max Withdrawal Calculation

  • Added gas fee estimation for NATIVE EVM tokens in max withdrawal endpoint
  • Max withdrawal now subtracts estimated gas fee to prevent "Insufficient funds" errors
  • Formula: maxAmount = availableBalance - platformFee - estimatedGas

String Concatenation Bugs

  • Fixed critical string concatenation issues in balance calculations (7 locations)
  • Database stores balances as strings, causing concatenation instead of addition
  • Example bug: "0.00689273" + "0.0001" resulted in "0.006892730.0001" instead of 0.00699273
  • Added parseFloat() before all arithmetic operations on wallet balances

Floating-Point Precision Errors

  • Added EVM chains to balance precision function
  • Fixed precision errors like 0.000890629999999999 displaying instead of 0.00089063
  • Added chains: BSC, ETH, POLYGON, ARBITRUM, OPTIMISM, BASE, AVAX, FTM, CELO, RSK (all with 8 decimal precision)

Gas Fee Reconciliation

  • Implemented gas fee reconciliation for NATIVE EVM withdrawals
  • Compares estimated vs actual gas used after transaction confirms
  • Refunds difference if overestimated, deducts if underestimated
  • Keeps database balance synchronized with on-chain balance

Private Ledger Integration

  • Fixed withdrawal balance checks to consider private ledger
  • For PERMIT tokens, now checks: availableBalance = wallet_data.balance - offchainDifference
  • Prevents users from withdrawing admin fees collected in cross-token exchanges
  • Applied in both max withdrawal and withdrawal validation

Monero (XMR) Deposit Processing

  • Fixed XMR deposit deadlock issue
  • Created processMoneroTransactionDirect method to handle deposits when wallet is already open
  • Prevents "0/120 attempt" stalling on deposits

Technical Improvements

Balance Checking Logic

  • Changed from checking wallet.balance (total across all chains) to wallet_data.balance (chain-specific available balance)
  • Ensures users can only withdraw what's actually available on the specific blockchain

Gas Estimation

  • Implemented proper gas estimation for NATIVE EVM tokens before withdrawal
  • Uses 21000 gas limit for standard transfers
  • Fetches current gas price from blockchain
  • Falls back to conservative estimates if estimation fails

Private Ledger Logic

  • offchainDifference > 0: Admin fees collected (reduces available balance)
  • offchainDifference < 0: User credited from exchange (increases available balance)
  • Only applies to PERMIT contract type tokens
## Fixed

### Cron Jobs
- **Fixed** Cron jobs not showing status updates in admin panel
- **Fixed** Fiat currency fetch timeout errors (increased from 5s to 30s)
- **Fixed** Missing API key validation for currency fetch
- **Fixed** Cron status broadcasts now properly sent via WebSocket
- **Fixed** OpenExchangeRates and ExchangeRate API timeout issues


## Improved

### Cron System
- **Improved** Added status broadcasts for running/completed/failed states
- **Improved** Increased timeout for external API calls (5s → 30s)
- **Improved** Better error messages and validation
- **Improved** Cron job monitoring continues running (as designed for production)

### Error Handling
- **Improved** Better null/undefined checks throughout codebase
Top