Trustless AI-Powered Treasury Management for Corporate DeFi
Aicetro enables corporate smart accounts to delegate limited treasury management permissions to AI agents without introducing admin backdoors or trusted intermediaries. All delegation rules are enforced on-chain, and users retain full control with instant emergency stop and revocation capabilities.
This project is submitted to the MetaMask Smart Accounts x Monad Dev Cook Off and utilizes all four required technologies:
- β Monad Testnet - Smart contracts deployed and verified
- β OpenRouter - Multi-provider AI integration (Claude, GPT-4, DeepSeek)
- β Envio - Real-time blockchain indexing via HyperIndex
- Overview
- Smart Contracts
- Key Features
- Deployed Contracts
- Architecture
- Security Guarantees
- Installation
- Usage
- Testing
- License
Traditional DeFi treasury management requires either:
- Manual operations - Time-consuming, requires 24/7 monitoring
- Multi-sig with AI - Introduces trusted parties and delays
- Admin keys - Centralization risk, potential for exploitation
Aicetro's Solution:
- β Trustless delegation - AI agent has limited permissions granted by user
- β On-chain enforcement - All limits and rules enforced by smart contracts
- β Zero admin keys - No one (including team) can override user decisions
- β Instant revocation - User can stop AI at any moment
- β Emergency stop - One-click pause for any suspicious activity
Main delegation manager that enforces all trustless guarantees.
Key Functions:
// Grant limited permissions to AI agent
function grantDelegation(
address aiAgent,
uint256 dailyLimitUSD,
address[] calldata allowedProtocols,
uint256 validUntil
) external;
// AI agent executes on behalf of user (within limits)
function executeForUser(
address user,
address protocol,
bytes calldata data,
uint256 amountUSD
) external;
// User instantly revokes all permissions
function revokeDelegation() external;
// User pauses AI agent immediately
function emergencyStop() external;Features:
- Daily spending limits (reset every 24 hours)
- Protocol whitelist (only approved DeFi protocols)
- Time-based expiration (delegation auto-expires)
- Spent amount tracking (transparent usage)
Multi-account management for institutional users.
Key Functions:
// Create corporate account for delegation
function createAccount(
string calldata name,
address owner
) external returns (address);
// Get all accounts for an owner
function getAccountsByOwner(
address owner
) external view returns (address[] memory);Features:
- Multiple treasury accounts per institution
- Separate delegations per account
- Unified management interface
Additional security layer for emergency situations.
Key Functions:
// Global emergency stop (user-controlled)
function triggerEmergency(address user) external;
// Check if account is in emergency mode
function isEmergency(address user) external view returns (bool);Features:
- User-initiated emergency mode
- Cannot be triggered by admins or third parties
- Prevents all AI executions until user resolves
Helper contract for AI agent transaction execution.
Manages approved DeFi protocols for delegation.
Additional risk management and limit enforcement.
- Zero admin keys - No one can override user decisions
- On-chain enforcement - All limits verified by smart contracts
- User sovereignty - Full control remains with account owner
- Emergency stop - One-click pause for suspicious activity
- Instant revocation - Remove all AI permissions immediately
- Real-time monitoring - Track every AI action on-chain
- Daily limit tracking - See exactly how much AI has spent
- Protocol whitelist - Control which DeFi protocols AI can use
- Time-based expiration - Delegations automatically expire
- Daily spending caps - Prevent excessive losses
- Protocol restrictions - Limit exposure to specific protocols
- Automatic reset - Limits refresh every 24 hours
| Contract | Address | Verified |
|---|---|---|
| TrustlessDeFiTreasury | 0x98691ae190682dddBde3cd4c493B2249D2086E5B |
β View |
| CorporateTreasuryManager | 0x98691ae190682dddBde3cd4c493B2249D2086E5B |
β View |
| EmergencyController | 0x4BE4FE572bAce94aaFF05e4a0c03ff79212C20e5 |
β View |
Network Details:
- Chain ID: 2814 (Monad Testnet)
- RPC URL:
https://testnet-rpc.monad.xyz - Block Explorer: https://testnet.monadscan.io
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Smart Account β
β (Corporate Treasury) β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
β Grants Limited Delegation
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TrustlessDeFiTreasury Contract β
β β
β β’ Daily Limit: $50,000 β
β β’ Allowed Protocols: [Nabla, Lynx, Infinex] β
β β’ Valid Until: 30 days β
β β’ Emergency Stop: Active β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
β AI Agent Executes (within limits)
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DeFi Protocols β
β β
β β’ Nabla Finance (Lending) β
β β’ Lynx (Yield Aggregator) β
β β’ Infinex (Perps Trading) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Flow:
- User grants delegation with specific limits
- AI agent analyzes markets and generates recommendations
- AI executes approved strategies (contract validates limits)
- User monitors all actions and can stop/revoke at any time
- β Override user decisions
- β Bypass daily limits
- β Use non-whitelisted protocols
- β Continue after emergency stop
- β Prevent user revocation
- β Access funds after expiration
- β Revoke delegation instantly (1 transaction)
- β Emergency stop (1 transaction)
- β Change limits at any time
- β Add/remove protocols
- β Extend or shorten expiration
- β Monitor all AI actions on-chain
- β No admin keys - Code is immutable
- β No upgradability - No proxy patterns
- β No timelocks - Instant user control
- β No multi-sig required - Direct user actions
- β No off-chain dependencies - Pure on-chain logic
# Clone the repository
git clone https://github.com/MixasV/aicetro-contracts.git
cd aicetro-contracts
# Install dependencies
pnpm install
# Compile contracts
pnpm hardhat compile- Create
.envfile:
MONAD_RPC_URL=https://testnet-rpc.monad.xyz
DEPLOYER_PRIVATE_KEY=your_private_key_here- Deploy contracts:
pnpm hardhat run scripts/deploy.ts --network monadTestnet- Verify on MonadScan:
pnpm hardhat verify --network monadTestnet <CONTRACT_ADDRESS>const treasury = await ethers.getContractAt(
'TrustlessDeFiTreasury',
TREASURY_ADDRESS
);
// Grant AI agent permission for 30 days
await treasury.grantDelegation(
AI_AGENT_ADDRESS,
ethers.parseUnits("50000", 18), // $50K daily limit
[NABLA_ADDRESS, LYNX_ADDRESS], // Allowed protocols
Math.floor(Date.now() / 1000) + 30 * 24 * 60 * 60 // 30 days
);// Instantly pause AI agent
await treasury.emergencyStop();
// Or completely revoke delegation
await treasury.revokeDelegation();# Run all tests
pnpm hardhat test
# Run with gas reporting
REPORT_GAS=true pnpm hardhat test
# Run coverage
pnpm hardhat coverage| Contract | Size | Optimized |
|---|---|---|
| TrustlessDeFiTreasury | ~10 KB | β |
| CorporateTreasuryManager | ~4 KB | β |
| EmergencyController | ~2 KB | β |
All contracts are within the 24 KB deployment limit.
- Live Demo: [Coming Soon]
- Full Platform: Private repository (backend + frontend)
- Documentation: See main project README
- Hackathon Submission: Monad Builder's Cup
This repository contains only the smart contracts for transparency and security auditing. The full platform (backend AI engine and frontend) is in a private repository.
For security researchers:
- Bug reports welcome via GitHub Issues
- Responsible disclosure for critical vulnerabilities
MIT License - See LICENSE file for details.
Note: Smart contracts are open-source for transparency and trustless verification. The AI execution logic and backend infrastructure are proprietary.
Testnet Deployment Only
These contracts are currently deployed on Monad Testnet for hackathon demonstration purposes.
DO NOT USE WITH REAL FUNDS.
A professional security audit is required before any mainnet deployment.
- Developer: @MixasV
- Project: Aicetro (DeFiTreasury AI)
- Hackathon: Monad Builder's Cup 2025
- Monad Foundation - For the Builder's Cup hackathon and testnet infrastructure
- OpenRouter - For AI provider aggregation
- Envio - For blockchain indexing capabilities
- OpenZeppelin - For battle-tested smart contract libraries
Built with β€οΈ for trustless DeFi treasury management
Securing institutional treasuries without compromising decentralization