# Smart Contract Execution Layer

The Execution Layer is the on-chain manifestation of Axon. It is a set of non-custodial, modular smart contracts designed to execute the intents generated by the AI engine safely and efficiently.

#### Non-Custodial Architecture

A core tenet of Axon is that the protocol never takes custody of user funds.

* Delegated Authority: Users deposit funds into their own "Smart Vault" (a minimal proxy contract) or grant specific allowances to the Axon Router. The AI has permission to route funds between approved protocols but lacks the permission to withdraw funds to external wallets not whitelisted by the user.
* EIP-2612 & Permit Integration: Where possible, Axon utilizes gas-less approvals via signatures (Permit), reducing the friction and cost associated with traditional approve() transactions.

#### Transaction Batching & Atomicity

To maximize capital efficiency, Axon never executes a single action when it can execute a workflow.

* Multicall Aggregation: Complex strategies (e.g., "Harvest reward token A, swap for Token B, add to Liquidity Pool C, stake LP token") are bundled into a single atomic transaction. This reduces gas costs by amortizing the base transaction fee across multiple operations.
* Atomic Reversion: Because transactions are bundled atomically, if any single step of the strategy fails (e.g., slippage exceeds tolerance on the swap), the entire transaction reverts. This prevents partial execution states where funds could be left stranded in an intermediate asset.

#### Abstracted Liquidity & Cross-Chain Interoperability

Axon treats liquidity as a unified layer rather than fragmented chains.

* Intent-Based Bridging: When the AI identifies a yield opportunity on a different chain (e.g., moving USDC from Ethereum to Arbitrum), it utilizes a "Burn-and-Mint" or "Lock-and-Unlock" mechanism via integrated partners like LayerZero or Chainlink CCIP.
* Just-In-Time (JIT) Liquidity: For high-frequency strategies, Axon can utilize proprietary liquidity pools to advance funds on the destination chain immediately while the bridge transaction settles in the background, effectively eliminating the 15-30 minute bridge latency for the user.
* Pathfinder Routing: The execution engine utilizes a modified Dijkstra’s algorithm to calculate the most efficient path for any swap or bridge. It factors in gas costs, bridge fees, and swap impact to ensure the "Net Amount Received" is maximized.

#### MEV Protection

Axon contracts include built-in defenses against Miner Extractable Value (MEV) bots.

* Private RPC Submission: Transactions are routed through private mempools (such as Flashbots on Ethereum) to prevent sandwich attacks and front-running.
* Dynamic Slippage: The AI predicts the expected slippage based on current pool depth and sets the smart contract tolerance strictly, reverting transactions that are manipulated beyond this tight window.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.axontoken.vip/2.technical-architecture/smart-contract-execution-layer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
