Varla
OverviewWhat it is and why it matters.How It WorksLending against prediction markets, step by step.FeaturesLending, borrowing, leverage, and risk management.Supported MarketsPolymarket, Opinion, Kalshi, and more.
DocumentationProtocol docs, guides, and architecture.Smart ContractsPool, Collateral Manager, Oracle, Liquidation Engine.SDK ReferenceTypeScript SDK for protocol interactions.API ReferenceREST and GraphQL endpoints for market data.
BlogLatest news and announcements from Varla.FAQsFrequently asked questions about the protocol.Security & AuditsProtocol security, audits, and trust assumptions.Brand AssetsLogos, colors, and typography guidelines.
Sign up
Varla
Protocol
Overview What it is and why it matters.
How It Works Lending against prediction markets, step by step.
Features Lending, borrowing, leverage, and risk management.
Supported Markets Polymarket, Opinion, Kalshi, and more.
Developers
Documentation Protocol docs, guides, and architecture.
Smart Contracts Pool, Collateral Manager, Oracle, Liquidation Engine.
SDK Reference TypeScript SDK for protocol interactions.
API Reference REST and GraphQL endpoints for market data.
Resources
Blog Latest news and announcements from Varla.
FAQs Frequently asked questions about the protocol.
Security & Audits Protocol security, audits, and trust assumptions.
Brand Assets Logos, colors, and typography guidelines.
Sign up

Introduction

Overview
Varla 101

Protocol

Overview
Lending Model
Supply & Borrow Interest Rates Reserves
User Positions
Open Positions Supply Assets Borrow Assets Withdraw Assets Repay Loans
Risk Engine
Health Factor LTV & Thresholds Liquidations Market Resolution Oracle System

Markets

Overview
Polymarket
Opinion
Kalshi
Adapters

Token

Overview
Distribution
Utility & Governance
Varla Gems

Security

Overview
Trust Assumptions
Risk Disclosure
Risk Parameters

Resources

FAQ
Glossary
Links
Brand Assets

Getting Started

Overview
TypeScript SDK
GraphQL API
Smart Contracts

Smart Contracts

Overview
Core Protocol
VarlaPool VarlaOracle Interest Rate Liquidators Market Adapters
Governance & Access
Governance

References

SDK Reference
API Reference

Operations

Testing & Debugging
Contract Addresses

Security

Overview
Trust Assumptions
Risk Disclosure
Risk Parameters

Testing & Debugging

How to test your Varla integrations — forked mainnet testing with Anvil and common debugging patterns.

Forked Mainnet with Anvil

The recommended way to test Varla integrations is by forking Polygon mainnet using Foundry's Anvil. This gives you a local environment with real contract state, real Polymarket positions, and real oracle data — far more realistic than any testnet.

ℹ Why forked mainnet?
Forking mainnet means you're testing against real deployed contracts with real state. No test tokens, no synthetic data, no guessing whether testnet behavior matches production. What works on your fork will work on mainnet.
Start a forked mainnet bash
# Fork Polygon mainnet with Anvil
anvil --fork-url https://polygon-rpc.com --fork-block-number latest

# Your local RPC is now available at http://127.0.0.1:8545
# All mainnet contracts and state are available locally

Testing Workflow

1

Fork mainnet

Use Foundry's anvil --fork-url to create a local fork of Polygon mainnet. This gives you a realistic environment with real contract state.
2

Impersonate accounts

Use anvil_impersonateAccount to act as any address — useful for testing with real Polymarket positions without owning them.
3

Time travel

Use evm_increaseTime to simulate interest accrual, oracle staleness, and early-closure decay without waiting.
4

Test edge cases

Manipulate oracle prices, simulate liquidation scenarios, and test bad debt handling in a controlled environment.

Common Issues

Debugging checklist
Transaction reverted?
├── Check: Is oracle fresh? (isFresh() returns false → wait for update)
├── Check: Is health factor sufficient? (post-action HF must be ≥ 1.0)
├── Check: Is pool liquid? (enough available stablecoins for borrow)
├── Check: Is ERC-1155 approved? (setApprovalForAll must be called first)
└── Check: Is position eligible? (oracle must have active feed for tokenId)

Unexpected values?
├── Interest is per-second → debt grows between reads
├── Oracle uses min(spot, TWAP) → may be lower than expected
└── Early-closure decay → LTV drops near resolution
💡 SDK debugging
The SDK includes a debug: true option that logs all contract calls, parameters, and return values. Enable it during development.

Menu

  • Overview
  • How it works
  • Features
  • Documentations
  • FAQs

Ecosystem

  • Prediction markets
  • Builders
  • Integrations
  • Governance

Company

  • About
  • Terms
  • Privacy
  • Support

©2026 Varla Labs Inc. All rights reserved