Trading and Earn
Check how much USDC a wallet can withdraw from lending
Inspect the wallet’s fixed Aave and Morpho USDC positions on Base and Ethereum, then check an exact withdrawal amount before preparing it.
Workflow
Compare a funding goal
Call baseFundingGoal with the wallet and targetUsdc as a base-unit string. For 500 USDC, use 500000000. Add swapInputWei to compare a fee-bearing ETH swap and marketId for a Base Morpho Blue USDC supply position. Check each route’s state and minimum proceeds before preparing a transaction.
Read cash flows and returns
Call lendingReturns with the same wallet and Morpho Blue market ID. The latest 2,000 finalized blocks are used by default. Use fromBlock and toBlock to check earlier windows. Inspect opening and closing supply, deposits, withdrawals and redeemable value. An unmatched share change leaves the return unknown.
Find the wallet’s USDC positions
Call earnWalletExposure with the public EVM address and the networks to inspect. This read covers the configured Aave USDC reserves and Morpho USDC vaults on Base and Ethereum. Check which reads succeeded before reporting a zero balance. Other assets, vaults and protocols need their own position reads.
Check an exact withdrawal
Select the network and protocol from the position and call earnVaultCapacity with action set to withdraw. The amount is in USDC base units, so 1000000 means 1 USDC. Check state, observedUpperBound, constraints and unmeasured. For Morpho, the wallet position gives an upper bound. Available vault liquidity and the maximum redeemable amount still need verification. Aave checks reserve liquidity, but existing debt can constrain a collateral withdrawal. Refresh unavailable reads before preparing the exit.
Verify the exit
For a supported Aave position, use aavePrepare. For the configured Morpho vault, use morphoVaultPrepare. Read the input schema for the selected action, review and sign the resulting transaction, then refresh both the position and the wallet’s USDC balance after confirmation. An outstanding share balance can remain after a partial withdrawal.
Check a 1 USDC Morpho withdrawal on Base using a sample public address
curl -fsS "https://www.bitpont.com/api/v1/agent/earn/vault/capacity" \
-H 'Content-Type: application/json' \
-d '{"network":"base","protocol":"morpho","wallet":"0x000000000000000000000000000000000000dEaD","action":"withdraw","amount":"1000000"}'