const POOL_ADDRESS = "0xceCcE0EB9DD2Ef7996e01e25DD70e461F918A14b";
const poolABI = [
"function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external",
"function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) external",
"function repay(address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf) external returns (uint256)",
"function getReservesList() external view returns (address[] memory)",
];
const pool = new ethers.Contract(POOL_ADDRESS, poolABI, signer);
// 1. Supply collateral (e.g., HYPE, wstHYPE, ETH)
const collateralToken = new ethers.Contract(collateralAddress, erc20ABI, signer);
await (await collateralToken.approve(POOL_ADDRESS, collateralAmount)).wait();
await (await pool.supply(collateralAddress, collateralAmount, signer.address, 0)).wait();
// 2. Borrow USDXL (interestRateMode 2 = variable; stable NOT supported)
const USDXL_ADDRESS = "0x..."; // query from pool.getReservesList()
await (await pool.borrow(USDXL_ADDRESS, borrowAmount, 2, 0, signer.address)).wait();