The NEAR Intents TEE Solver Registry is a protocol that enables secure and private execution of NEAR Intents solvers using Trusted Execution Environment (TEE) technology. This project consists of smart contracts for managing solver registration and a server for launching and managing TEE solvers.
This protocol allows liquidity pools creation for NEAR Intents. Liquidity providers can transfer funds into the pools' smart contracts. Only the solvers who're running within TEE with the approved Docker images can be registered and authorized to operate against the pools' assets.
The system consists of two main components:
-
Smart Contracts
solver-registry: Support liquidity pools creation. Manage registration and verification of TEE solvers for each liquidity pool.intents-vault: The vault contract that manage the pool's asset within NEAR Intents.
-
Solver Management Server
- A TypeScript-based server that manages the lifecycle of TEE solvers
- Handles solver deployment and monitoring for each liquidity pool
- Rust and Cargo (latest stable version)
- Node.js (v20 or later)
- pnpm package manager
- Docker and Docker Compose
- NEAR CLI
- A NEAR account with sufficient NEAR tokens for funding the ephemeral accounts in each TEE solver
tee-solver/
├── contracts/ # Smart contracts
│ ├── solver-registry/ # Solver registry contract
│ ├── intents-vault/ # NEAR Intents vault contract
│ ├── mock-intents/ # Mock NEAR Intents contract for testing
│ └── mock-ft/ # Mock fungible token for testing
├── server/ # TEE Solver management server
└── scripts/ # Deployment and utility scripts
- Build the contracts:
Install cargo-near and run:
make all- Test the contracts
make test- Deploy the contracts:
cd contracts/solver-registry
cargo near deploy build-reproducible-wasm <contract-id>- cargo-near - NEAR smart contract development toolkit for Rust
- near CLI - Interact with NEAR blockchain from command line
- NEAR Rust SDK Documentation
Every time a new liquidity pool is created in the Solver Registry contract, the server will find the pools that needs to create a solver.
We'll use the TEE-powered AMM solver as the default solver to launch once a new liquidity pool is created in the solver registry contract.
- Navigate to the server directory:
cd server- Install dependencies:
pnpm install- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration- Start the server:
# Development mode
pnpm dev
# Production mode
pnpm build
pnpm startThis project uses TEE (Trusted Execution Environment) to ensure secure and private execution of NEAR Intents solvers.
The project is inspired by the incredible design of Shade Agent.
This project is licensed under the MIT License - see the LICENSE file for details.