DOCS / TUTORIAL: AAVE LENDING
Use a program-controlled key with Aave.
Use a program-controlled EVM key to set token allowance, supply to Aave, and later withdraw under application rules.
Integration status: the hosted EVM adapter accepts legacy native transfers. On a deployment advertising evm_chain_selection, it can select an EIP-155 chain ID, but it does not accept ERC-20 approvals, Aave Pool.supply calls or EIP-1559 transactions. This guide defines the contract-call and policy work required before lending is enabled.
1. Select the market
Choose an Aave market and chain from the Aave Pool documentation. Read the market's current PoolAddressesProvider, Pool proxy, token address, decimals, reserve status and risk parameters from that chain. Never copy an address from another network into a signing request.
2. Derive a dedicated EVM key
import * as web3 from '@solana/web3.js';
import {PairKeyClient} from '@pairkey/sdk';
const pairkey = new PairKeyClient({web3, storage: localStorage});
await pairkey.connect({
source: 'program', wallet, program: controllerProgramId,
mode: 'Onchain', namespace: 'org/acme/aave',
});
const key = await pairkey.key({chain: 'evm', chainId: marketChainId, path: [0]});
Pass chainId to key when the deployment supports chain selection. The current transaction adapter still cannot sign the contract calls needed to lend.
3. Approve only the needed allowance
Aave's Pool.supply(asset, amount, onBehalfOf, referralCode) requires the Pool to have token allowance. The application builds an ERC-20 approve(Pool, amount) transaction first, then builds the supply call. The program checks the token, Pool, beneficiary, amount and deadline in both exact payloads. Avoid an unlimited allowance unless your policy explicitly accepts it.
4. Sign and monitor lending actions
The planned EVM adapter must support calldata and the destination chain's transaction format. Once available, pass the built transaction to signAndSend with that chain's RPC, save the job ID, and confirm the transaction receipt and resulting aToken balance. For withdrawal, approve an exact Pool.withdraw call under a separate rule. See Aave market operations for the contract sequence.