Get available liquidity

Get available liquidity on Spark

Ethereum
Ethereum

Reads onchain state

Ready to run on Base

Reads how much of an asset a Spark reserve holds unborrowed right now. The number is the asset balance sitting in the reserve's spToken contract: what is actually there to fund a borrow or a withdrawal at this block. When it nears zero, suppliers cannot withdraw and borrowers cannot borrow until someone repays or supplies. Reach for it to cap a borrow or withdraw at what the reserve can pay out, taking a min with your target, or to require enough liquidity exists before a flash loan or large withdrawal so the transaction fails early instead of reverting inside the pool.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

More on Spark · 25

On other protocols · 3