@lending:debt
Current variable-rate debt of an account in a token, in base units (grows every block as interest accrues).
⚗️ Experimental — available at next.evmcrispr.com.
Returns: number
Syntax
Section titled “Syntax”@lending:debt(account token adapter?)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
account | address | Account to inspect |
token | address | Borrowed token (use @token(SYM)) |
[adapter] | lending-adapter | Lending protocol: AaveV3, Spark or CompoundV3 (default: the best available on the chain) |
Examples
Section titled “Examples”# Print the connected account's variable WXDAI debtprint "WXDAI debt:" @lending:debt(@me 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d)On-chain face (@debt!)
Section titled “On-chain face (@debt!)”Aave keeps the balance on a per-reserve debt token, so this is two hops with a computed target: the debt token address is word 10 of the reserve struct, and the balance is read off whatever address that word holds at assertion time. A market that migrates its debt token between building a batch and executing it is followed rather than cached.
Comet keeps the borrow on the market itself, so it is a single read.
The account may be a live value on either protocol; the token and the market resolve at composition time.