AutoPerp

A privacy-first perpetual trading protocol on Aleo, that uses zero-knowledge proofs

About

## Wave 3 submission

In this Wave, we moved AutoPerp from a partially private design to a strict private-core architecture and shipped full frontend wiring for private contract transactions.

Key updates:

Added a new strict-private Leo program: autoperp_core_private_v1.aleo (record-first core path). Kept autoperp_core_v5.aleo aligned for settlement-compatible mode while separating private-mode responsibilities clearly. Updated program.json naming consistency and deployment-ready manifests. Implemented private record utilities in frontend (vault + pool record discovery/parsing/serialization). Rewired main user flows to private-core signatures: Open trade Close position Pool deposit Agent-assisted execution Added robust Shield wallet handling for record access permission failures (Program not allowed) with reauthorization flow and user-safe error handling. Updated home comparison copy and rewritten professional README with architecture documentation and system diagram. Verified frontend diagnostics and build pipeline after integration. Deliverables:

GitHub repository: https://github.com/dinitheth/AutoPerp

## Wave 4 submission

๐ŸŒŠ Wave 4 Update

For this 4th Wave, we completely fulfilled our previous wave's roadmap by building the fully deployable v5 core alignment, hardening our privacy and settlement architecture, and deploying the unified protocol to the Aleo testnet. First, we resolved all ABI mismatches between the frontend and the Leo transitions, fixed the mapping access constraints for Leo's async/finalize blocks, and stabilized the settlement-capable flow. We audited the smart contract behavior to ensure our privacy claims perfectly match the on-chain implementation, explicitly separating our public token deduction mechanics from our encrypted private position records.

With the architecture hardened, we successfully built and deployed four distinct, production-ready zero-knowledge smart contracts to the testnet during this wave:

๐Ÿ—๏ธ 1. The Dual-Core Trading Protocol & Settlement Architecture We stabilized the true settlement-capable flow we promised. We deployed the autoperp_core programs, which now natively hook into the testnet USDCx stablecoin. We built a secure 2-step transaction flow (deposit collateral โ†’ open position) that handles 100% real token deductions and PnL payouts mapping updates, all while keeping the actual trade parameters completely encrypted inside a private zero-knowledge record.

๐Ÿค– 2. The AI "AgentAuth" Framework Hardening We deployed the finalized autoperp_agent_v2.aleo program. This establishes our unique privacy-first AI delegation system. Users can now securely grant an off-chain AI agent time-bound, cryptographically scoped permissions to manage trades purely via on-chain AgentAuth records โ€” completely avoiding the massive security flaw of handing private keys over to an AI bot.

๐Ÿ”ฎ 3. Standalone On-Chain Oracle & TWAP Engine We built and deployed a robust, administrative-guarded oracle system from scratch in autoperp_oracle.aleo. It provides a 70/30 time-weighted average price (TWAP) blend to calculate exact Mark Prices for BTC, ETH, and ALEO markets, and internally calculates direction-dependent Funding Rates based on oracle-to-mark price divergence.

๐ŸŽจ 4. Frontend Alignment and UX Polish

We completely wired the frontend React app to these testnet deployments. The UI now dynamically fetches real-time "Vault Balances" directly from the core contract's mappings rather than relying on mocks. We implemented seamless global state toggling between Public and Private trading modes, fixed all ABI mismatches, and aligned the entire UX workflow with the new secure settlement architecture.

๐Ÿ”— Deployed Contracts

autoperp_core_v5.aleo โ€” https://testnet.explorer.provable.com/program/autoperp_core_v5.aleo autoperp_core_private_v2.aleo โ€” https://testnet.explorer.provable.com/program/autoperp_core_private_v2.aleo autoperp_agent_v2.aleo โ€” https://testnet.explorer.provable.com/program/autoperp_agent_v2.aleo autoperp_oracle.aleo โ€” https://testnet.explorer.provable.com/program/autoperp_oracle.aleo

๐ŸŒ Live Demo โ€” https://autoperp.vercel.app/

## Wave 5 submission

Wave 5 Submission

The Wave 4 review flagged five critical gaps โ€” each one became a core priority for Wave 5.๐Ÿ› ๏ธ

  • ๐Ÿ”ฎ Oracle Disconnect

"The oracle computes TWAP and funding rates but neither core program reads from it (prices are user-supplied inputs)... Consider connecting the oracle to core programs via cross-program calls."

โœ… Fixed: We upgraded the entire architecture to Leo 4.0 to use cross-program external mapping reads. Both core programs (autoperp_core_v9 and autoperp_core_private_v9) now execute Mapping::get_or_use(autoperp_oracle_v2.aleo::prices) in their finalize blocks. The smart contract directly reads the oracle on-chain and enforces a strict safety divergence check โ€” โ‰ค1% for public, โ‰ค5% for private.

  • ๐Ÿค– Agent Frontend Disconnect

"The agent auth program is deployed but never called by the frontend (the AI 'agent' is just a chatbot)... Consider wiring the AgentAuth flow into the frontend."

โœ… Fixed: The AI is no longer just a chatbot. Agent.tsx is now fully wired to the useAgentAuth hook. When a user approves an AI-generated trade, the frontend immediately triggers an on-chain grant_auth() transaction, issuing a real scoped bitmask permission ticket to the Agent program on the blockchain. We also added UI panels to manage and revoke on-chain permissions, plus ๐Ÿค– Agent badges across the trading UI to track AI-opened positions.

  • ๐Ÿ“ˆ Funding Rates Ignored

"Funding rates are computed but never applied to positions."

โœ… Fixed: Funding rates now natively impact PnL. When close_position is called, the core programs read funding_rates and funding_direction directly from the Oracle program on-chain. The zero-knowledge circuit then mathematically applies the rate against position size to deduct or credit the user's final USDCx settlement payout in the finalize block.

  • โšก Single-Owner Scalability Bottleneck

"The private mode's PoolState being a single-owner record is a fundamental scalability constraint."

โœ… Fixed: We entirely discarded the single-owner PoolState private record architecture. The private core now uses scalable shared public mappings (pool_balance, pool_shares) for aggregate pool accounting, while each user's PositionRecord and TraderVault stay fully encrypted. Thousands of users can now interact with the private pool concurrently.

  • ๐Ÿ”’ Privacy Gap in Exits

"Consider exploring private token transfers to close the privacy gap in the private mode's deposit/withdraw paths."

โœ… Fixed: 100% shielded exit liquidity achieved. We integrated test_usdcx_stablecoin.aleo::transfer_public_to_private into the private core. When users withdraw vault collateral or claim LP payouts in private mode, the public pool burns the tokens and mints a fully encrypted Private Token Record for the user. Withdrawals are completely hidden from the block explorer.

๐Ÿ”ฅ Live Demo โ€” https://autoperp.vercel.app/

Prizes

  • Wave 5 grant ยท 178 USDT

From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

No public repo linked, so we can't tell.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.