Stakra (built by Verisafe Protocol) is a decentralized lending protocol providing non-custodial credit lines and Buy Now, Pay Later (BNPL) functionality on the BNB Chain. It leverages isolated smart vaults and a proprietary ZK-verified price oracle.
Ask Wiki for more technical details https://deepwiki.com/Sneekyboots/Stakra
Stakra implements an isolated vault pattern where every user receives a dedicated CollateralVault contract instance. This eliminates shared pool risks and ensures that one user's liquidation or bad debt does not affect the rest of the protocol.
| Component | Purpose | Contract |
|---|---|---|
| Vault Factory | The entry point that deploys isolated vaults for each user. | VaultFactory.sol |
| Collateral Vaults | Individual smart contracts holding BNB collateral and managing credit. | CollateralVault.sol |
| Credit NFTs | Portable ERC-721 tokens representing active credit lines (on opBNB). | CreditNFT.sol |
| Price Oracle | ZK-verified BNB/USD price feeds via commit-reveal schemes. | VerisOracle.sol |
| Liquidation Engine | Monitors vault health and executes swaps via PancakeSwap. | LiquidationEngine.sol |
- Isolated Vaults: Per-user contract deployment to mitigate contagion risk.
- ZK-Oracle Technology: Powered by Veris, a proprietary ZK-style oracle for tamper-proof price data.
- Non-Custodial: Users maintain control of collateral with an
emergencyWithdraw()function. - Portable Credit: Credit lines are minted as NFTs on opBNB, allowing for ultra-low gas ($0.001) merchant payments.
- LTV (Loan-to-Value) Ratio: 70% (Max credit issued against collateral).
- Liquidation Threshold: 85% (Triggered when collateral value drops).
- Protocol Fees: 0.5% on credit lines | 0.1% on liquidations.
- Example: 0.5 BNB @ $350 ($175 collateral) → $122.50 Max Credit.
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash && foundryup
# Clone and install dependencies
git clone <repo_url>
cd verisafe
forge install OpenZeppelin/openzeppelin-contractsforge build
forge script script/Deploy.s.sol --rpc-url bsc_testnet --private-key $PRIVATE_KEY --broadcast --verifycd agent
npm install ethers
# Submit live price or simulate a crash
node oracle-agent.js --price 210- Deploy Vault: User creates their personal vault via
VaultFactory. - Deposit: User locks BNB collateral into their specific vault.
- Request Credit: System verifies price via VerisOracle and issues a Credit NFT.
- Spend: Use the Credit NFT for BNPL/payments on opBNB.
- Liquidation: If LTV exceeds 85%, the
LiquidationEngineswaps collateral on PancakeSwap to make the lender whole.
Note: Currently deployed on BSC Testnet (Chain 97). Frontend is built with Next.js; Liquidations utilize PancakeSwap pools.
Would you like me to create a technical deep-dive into the Veris ZK-Oracle logic next?
Non-custodial smart collateral for Web3 credit & BNPL on BNB Chain. Powered by Veris — our proprietary ZK event oracle.
| Contract | Chain | Purpose |
|---|---|---|
VerisOracle.sol |
BSC | ZK-style price oracle |
CreditNFT.sol |
opBNB | Portable credit guarantee NFT |
VaultFactory.sol |
BSC | Deploys one vault per user |
CollateralVault.sol |
BSC | Per-user isolated collateral vault |
LiquidationEngine.sol |
BSC | Auto-liquidation via PancakeSwap |
# 1. Install Foundry
curl -L https://foundry.paradigm.xyz | bash && foundryup
# 2. Clone and install
git clone <your-repo>
cd verisafe
forge install OpenZeppelin/openzeppelin-contracts
# 3. Environment
cp .env.example .env
# Fill in PRIVATE_KEY and BSCSCAN_API_KEY
# 4. Get testnet BNB
# BSC: https://testnet.bnbchain.org/faucet-smart
# opBNB: https://opbnb-testnet-faucet.bnbchain.org# Compile
forge build
# Deploy to BSC testnet
forge script script/Deploy.s.sol \
--rpc-url bsc_testnet \
--private-key $PRIVATE_KEY \
--broadcast \
--verify
# Copy the printed addresses into your .envcd agent
npm install ethers
# Submit live BNB price to oracle
node oracle-agent.js
# DEMO: Simulate price crash to $210 (triggers liquidation)
node oracle-agent.js --price 210
# Continuous mode (60s updates)
node oracle-agent.js --continuous1. forge script Deploy.s.sol --broadcast # Deploy all contracts
2. node agent/oracle-agent.js # Seed price ($350)
3. [Frontend] Connect wallet → deployVault() # Personal vault deployed
4. [Frontend] deposit(0.5 BNB) # BNB into vault
5. [Frontend] requestCredit(12250) # $122.50 credit → NFT minted
6. [Frontend] creditNFT.spend(tokenId, 6000, merchant) # Pay $60
7. node agent/oracle-agent.js --price 210 # Simulate crash
8. [Frontend] liquidationEngine.checkAndLiquidate(vault) # Auto-liquidation fires
- LTV ratio: 70% (credit issued at 70% of collateral value)
- Liquidation threshold: 85% (auto-liquidates when LTV hits 85%)
- BNB deposit: 0.5 BNB @ $350 = $175 collateral → $122.50 max credit
- Liquidation trigger: BNB drops to ~$294 (35% crash)
- opBNB gas per merchant check: $0.001
- Protocol fee: 0.5% of credit lines + 0.1% of liquidations
User Wallet
│
│ deployVault()
▼
VaultFactory ──deploys──► CollateralVault (per user)
│
deposit() │ requestCredit()
│
VerisOracle
(ZK price proof)
│
CreditNFT minted
(on opBNB, $0.001)
│
[IF DEFAULT]│
▼
LiquidationEngine
PancakeSwap swap
Lender made whole
Surplus → user