On-Chain Integration
How to submit on-chain transactions to open and close leveraged positions, and what the backend handles automatically after each step.
Position lifecycle
User action Backend (automatic)
─────────── ───────────────────
1. Approve USDC
2. Call createPosition() ──────────► Detect event
Place exchange order
Finalize on-chain
──► position.opened WebSocket event
3. Call requestClose() ────────────► Detect event
Sell tokens on exchange
Distribute proceeds on-chain
──► position.closed WebSocket event
Other exits (no user action needed):
Market resolves ─────────────────► Settle all positions
Price breaches threshold ────────► Liquidate positionWallet types
Opening a position (Direct EOA)
1. Approve USDC
2. Call createPosition
createPosition3. What happens next (automatic)
Closing a position
Other exit paths
Wallet integration patterns
Polymarket Safe
Polymarket Proxy
Polymarket Deposit Wallet
Contract ABIs
Vault
Last updated

