Skip to content

availproject/ca-sc

Repository files navigation

Nexus Vault

Production-grade upgradeable smart contract vault for the Avail Nexus cross-chain intent settlement protocol.

Overview

Nexus Vault enables secure handling of cross-chain intents with support for ERC20 tokens and native assets across multiple blockchain ecosystems (Ethereum, Fuel, Solana, Tron). The vault uses an intent-based architecture where users sign messages off-chain and relayers execute transactions on their behalf.

Architecture

Core Components

  • Vault.sol - Main upgradeable contract handling deposits, fulfillments, and settlements

Key Features

  • Intent-Based Execution: Users sign intents off-chain; relayers execute on-chain
  • Gasless User Experience: Users only pay gas once for token approvals
  • Cross-Chain Support: Handles intents across Ethereum, Fuel, Solana, and Tron
  • Signature Verification: EIP-191 compliant message signing
  • Reentrancy Protection: Transient reentrancy guards for gas efficiency
  • Access Control: Role-based permissions for upgrades and settlements

Request Flow

  1. Deposit - User signs intent, relayer deposits funds into vault
  2. Fulfillment - Solver fulfills the intent on destination chain
  3. Settlement - Avail blockchain multisig settles payments to solvers

Usage

Prerequisites

node >= 18.0.0
npm >= 9.0.0

Installation

npm install

Testing

# Run full test suite
npx hardhat test

# Run tests with coverage
npx hardhat coverage

# Run tests on local network
npm run test:local

Deployment

# Compile contracts
npm run compile

# Deploy to multiple networks
npm run deploy:multi

# Upgrade existing proxies
npm run upgrade:multi

# Estimate gas costs
npm run estimate-gas

Contract Addresses

Mainnet and testnet addresses to be added post-deployment

Security

  • Audits: Contracts are designed following OpenZeppelin best practices
  • Upgradeability: UUPS proxy pattern with role-based upgrade authorization
  • Reentrancy: Transient reentrancy guards protect all state-changing functions
  • Signature Replay Protection: Nonce-based replay protection for all operations

Mayan Route Data Trust Boundary

Vault.depositMayan verifies the user signature over the canonical Request fields only. The route-specific routeData is intentionally relayer-supplied and is not included in the Vault-level signed message. Safety for those route parameters is enforced by the Mayan contracts during execution. This means the Vault treats Mayan as the validation boundary for swap path, intermediate token, minimum middle amount, and related route execution parameters.

Access Control Roles

  • DEFAULT_ADMIN_ROLE - Contract administration
  • UPGRADER_ROLE - Contract upgrade authorization
  • SETTLEMENT_VERIFIER_ROLE - Settlement signature verification

Dependencies

License

MIT License - see individual contract files for SPDX identifiers.


Built by Avail - The unification layer of Web3

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors