Vault System

On-chain Solidity smart contracts owned and deployed by users for secure trading

Overview

Vaults are on-chain Solidity smart contracts owned and deployed by users. They store funds, record trades, and enable both manual and automated position management. All swaps and token handling happen inside the vault contract with full user ownership and transparency.

🔐 Core Features

User-Owned Smart Contract

Each vault is a Solidity smart contract deployed by the user. DevExLabs does not hold custody. All trades and balances are on-chain and transparent.

Supported Tokens

WPLS
DAI
pDAI
PLSX
pWBTC
HEX

Trading Logic

userBuy(...)

Opens a trade by swapping tokens via PulseX Router and records trade metadata.

userCloseTrade(...)

Allows the user to close the trade manually.

platformCloseTrade(...)

Allows the platform bot to close the trade automatically when profit conditions are met.

Fees

• 0.4% platform fee on both buy and sell side

• Fees are sent to the feeReceiver address

• Platform covers the gas cost of auto-closing trades

Emergency Withdrawals

• Supported when the vault is paused

• Only the vault owner can trigger withdrawals of tokens

⚙️ Lifecycle of a Trade

1

Vault Deployment

Deployed via the MinimalVaultFactory. Vault owner is set as Ownable.

2

Funding the Vault

User transfers supported tokens into the vault contract.

3

Opening a Trade (userBuy)

• Requires: path, amountIn, amountOutMin, targetSellAmountMin, deadline

• Fee is deducted

• Swap is executed via PulseX Router

• Trade is recorded in a TradeRecord

4

Closing a Trade

Manual (userCloseTrade): User closes trade using the reverse path

Auto (platformCloseTrade): Bot closes trade if profit target is met

5

Trade Completion

Vault resets the record status and optionally prepares for next trade.

🔐 Security Model

Funds remain in the vault unless actively used for a swap

Only the vault owner or the platform address can initiate trade closures

Vaults use ReentrancyGuard and SafeERC20 standards for protection

Processing locks prevent concurrent trade interference

📌 Advanced Notes

Platform Address

Must differ from owner (enforced in constructor).

Gas Handling

Platform pays for gas during automated trade closures.

Vault Pausing

Owner can pause/unpause vault to block new trades or enable emergency withdrawals.