Smart Contracts
Technical documentation for DevExLabs smart contract architecture
Vault Contract
MinimalAdvancedVault
A user-owned vault that handles trades, tracks positions, and interacts with PulseX routers
Key Functions
userBuy()Opens a trade by routing tokens via PulseX
userCloseTrade()Lets users close the trade manually
platformCloseTrade()Lets the platform bot close trades if profit target is reached
Factory Contract
MinimalVaultFactory
Contract Address
0xd9f3916F83b73d668fCD79acb182d268bb8849d8Deploys user vaults with owner, platform, and feeReceiver logic enforced
Constructor enforces platform ≠ owner to ensure safety
Uses OpenZeppelin's Ownable, ReentrancyGuard, SafeERC20
Trade Logic
Buy
- • Deducts 0.4% fee
- • Executes trade using PulseX
- • Records full trade metadata
Sell
- • Auto or manual
- • Deducts 0.4% fee
- • Uses same router with reverse path
Fee Summary
- • Platform fee (0.4%)
- • Applied on both buy and sell operations
- • Fees collected by designated feeReceiver address
Security Controls
Owner-only actions for withdrawals and pausing
Emergency withdrawal functions enabled when vault is paused