Giving an AI agent control over DeFi lending without proper safeguards is like handing over your entire crypto portfolio with a sticky note saying "be careful." The LENDING_ASSET_WHITELIST policy in WAIaaS ensures your agent can only lend the specific tokens you've explicitly approved, preventing it from making high-risk lending decisions with your entire balance. This default-deny approach means unauthorized tokens are blocked automatically, even if your agent's logic goes haywire.
Why Asset Whitelisting Matters for DeFi Security
DeFi lending protocols like Aave and Compound support hundreds of tokens, but not all are created equal. Some tokens have high volatility, poor liquidity, or smart contract risks that could lead to liquidation or permanent loss. An AI agent optimizing for yield might deposit volatile altcoins as collateral without understanding the liquidation risks, or lend experimental tokens that could lose value overnight.
The stakes are real: in DeFi, wrong asset choices can trigger liquidations, expose you to smart contract exploits, or lock funds in illiquid positions. Without explicit controls, an autonomous agent has no way to distinguish between battle-tested assets like USDC and risky experimental tokens.
How LENDING_ASSET_WHITELIST Works
WAIaaS implements a default-deny security model where your AI agent cannot interact with any lending protocol assets unless they're explicitly whitelisted. The LENDING_ASSET_WHITELIST policy lets you define exactly which tokens your agent can deposit, borrow, or use as collateral.
Here's how to create a lending asset whitelist that only allows USDC and WETH for lending operations:
curl -X POST http://localhost:3100/v1/policies \
-H 'Content-Type: application/json' \
-H 'X-Master-Password: <password>' \
-d '{
"walletId": "<wallet-uuid>",
"type": "LENDING_ASSET_WHITELIST",
"rules": {
"allowed_assets": [
{
"address": "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM",
"symbol": "USDC",
"chain": "solana",
"max_supply_amount": "10000",
"max_borrow_amount": "5000",
"allowed_as_collateral": true
},
{
"address": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs",
"symbol": "WETH",
"chain": "solana",
"max_supply_amount": "5",
"max_borrow_amount": "2",
"allowed_as_collateral": true
}
]
}
}'
When your agent attempts any DeFi lending action, WAIaaS checks this whitelist first. If the token isn't on the list, the transaction is denied immediately. No exceptions, no overrides—default-deny means exactly that.
Combining with Other Security Policies
LENDING_ASSET_WHITELIST works alongside other WAIaaS policies to create layered security. You can combine it with LENDING_LTV_LIMIT to prevent over-leveraging:
curl -X POST http://localhost:3100/v1/policies \
-H 'Content-Type: application/json' \
-H 'X-Master-Password: <password>' \
-d '{
"walletId": "<wallet-uuid>",
"type": "LENDING_LTV_LIMIT",
"rules": {
"max_ltv": 0.65,
"buffer_percentage": 0.05
}
}'
This ensures your agent cannot borrow more than 65% of collateral value, providing a safety buffer against liquidation even with whitelisted assets.
For additional protection, add SPENDING_LIMIT to control transaction amounts:
curl -X POST http://localhost:3100/v1/policies \
-H 'Content-Type: application/json' \
-H 'X-Master-Password: <password>' \
-d '{
"walletId": "<wallet-uuid>",
"type": "SPENDING_LIMIT",
"rules": {
"instant_max_usd": 100,
"notify_max_usd": 500,
"delay_max_usd": 2000,
"delay_seconds": 900,
"daily_limit_usd": 5000
}
}'
Now your agent needs human approval for any lending transaction over $2,000, regardless of which whitelisted assets it wants to use.
Example: Secured AI Lending Agent
Here's how an AI agent safely interacts with lending protocols under these constraints:
# Agent attempts to supply USDC to Aave (allowed)
curl -X POST http://127.0.0.1:3100/v1/actions/aave-v3/supply \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"asset": "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM",
"amount": "1000"
}'
# Agent tries to supply random altcoin (blocked by whitelist)
curl -X POST http://127.0.0.1:3100/v1/actions/aave-v3/supply \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"asset": "SomeRandomTokenAddress",
"amount": "1000"
}'
The second request returns an error:
{
"error": {
"code": "POLICY_DENIED",
"message": "Asset not allowed by LENDING_ASSET_WHITELIST policy",
"domain": "POLICY",
"retryable": false
}
}
The agent's lending logic never executes—WAIaaS blocks the transaction at the policy layer before any funds move.
Three-Layer Security Architecture
WAIaaS implements three security layers between your AI agent and your funds:
Layer 1: Session Authentication
- Agents authenticate with JWT tokens (HS256)
- Tokens have configurable TTL and renewal limits
- Each session is scoped to specific wallets
Layer 2: Policy Enforcement
- 21 policy types including LENDING_ASSET_WHITELIST
- Default-deny: transactions blocked unless explicitly allowed
- 4 security tiers: INSTANT → NOTIFY → DELAY → APPROVAL
Layer 3: Human Oversight
- WalletConnect integration for mobile approvals
- Time delays with cancellation windows
- Kill switch via owner authentication
The LENDING_ASSET_WHITELIST operates at Layer 2, ensuring policy violations never reach the blockchain.
Quick Start: Secure Your AI Lending Agent
- Install and start WAIaaS:
npm install -g @waiaas/cli
waiaas init
waiaas start
- Create a wallet for your lending agent:
waiaas wallet create --name lending-agent --chain solana
Set up the asset whitelist policy (use the curl command above with your actual wallet ID)
Create a session for your AI agent:
waiaas session create --wallet-id <your-wallet-id>
- Test the protection by having your agent attempt to lend a non-whitelisted token—it should be blocked immediately.
Your AI agent now operates within strict boundaries, unable to touch any lending assets you haven't explicitly approved.
What's Next
LENDING_ASSET_WHITELIST is one of 21 policy types in WAIaaS's security framework. You can combine multiple policies to create sophisticated risk management rules tailored to your specific use case. Check out the full policy system and start building secure AI agents that you actually trust with your funds.
Ready to give your AI agent a wallet with proper guardrails? Explore the complete security framework at https://waiaas.ai and get started with the open-source code at https://github.com/minhoyoo-iotrust/WAIaaS.
Top comments (0)