What you can do
| supply | Supply an asset to a reserve | Approve the underlying to the Spoke, then Spoke.supply(reserveId, amount, onBehalfOf) |
| borrow | Borrow against collateral | Spoke.borrow(reserveId, amount, onBehalfOf) after checking getUserAccountData |
| repay | Repay debt | Approve the underlying to the Spoke, then Spoke.repay(reserveId, amount, onBehalfOf) |
| withdraw | Withdraw supplied assets | Spoke.withdraw(reserveId, amount, onBehalfOf). Pass a very large amount for a full withdrawal. |
| use as collateral | Enable or disable a supplied asset as collateral | Spoke.setUsingAsCollateral(reserveId, true, onBehalfOf) |
| native token | Supply, borrow, repay or withdraw the native token | Spoke.setUserPositionManager(gateway, true) once, then NativeTokenGateway.supplyNative(spoke, reserveId, amount) with msg.value |
| liquidate | Repay an unhealthy debt and take collateral | Approve the debt asset to the Spoke, then Spoke.liquidationCall(collateralReserveId, debtReserveId, user, debtToCover, receiveShares) |
Aave V4 is newer than V3 and has fewer live markets and chains. Check each Spoke before relying on it.
Each Spoke sets its own collateral factors, liquidation settings and oracle, so the same asset can carry different risk in different Spokes.
Approved position managers and gateways can act for a user. Revoke them with setUserPositionManager(manager, false) when they are not needed.
Withdrawals and borrows are limited by liquidity held in the Hub. High utilization blocks them.
Contracts
Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).Core Hub (Ethereum)pool on ethereum0xCca852Bc40e560adC3b1Cc58CA5b55638ce826c9
read getAssetCount()
Number of assets listed in this Hub.
read getAssetDrawnRate(uint256)
Current drawn borrow rate for a Hub asset id. Check the Hub source for the unit.
read getAssetConfig(uint256)
Config struct of a Hub asset id.
read getAssetAccruedFees(uint256)
Accrued fees for a Hub asset id.
read getSpokeCount(uint256)
Number of Spokes connected to a Hub asset id.
read isSpokeListed(uint256,address)
True if a Spoke is listed for a Hub asset id: (assetId, spoke).
read getSpokeAddress(uint256,uint256)
Spoke address at an index for a Hub asset id: (assetId, index).
Main Spoke (Ethereum)pool on ethereum0x94e7A5dCbE816e498b89aB752661904E2F56c485
write supply(uint256,uint256,address)
Supply an asset to a reserve: (reserveId, amount, onBehalfOf). Approve the underlying to the Spoke first, since the Spoke pulls it from msg.sender. Returns (shares, assets). Caller must be onBehalfOf or an approved position manager. Reverts if the reserve is not listed.
write withdraw(uint256,uint256,address)
Withdraw supplied assets: (reserveId, amount, onBehalfOf). The underlying goes to msg.sender. An amount above the maximum withdrawable means a full withdrawal. Caller must be onBehalfOf or an approved position manager.
write borrow(uint256,uint256,address)
Borrow an asset: (reserveId, amount, onBehalfOf). The underlying goes to msg.sender. Needs enough collateral. Reverts if the reserve is not listed or the user would exceed the maximum number of borrowed reserves. Caller must be onBehalfOf or an approved position manager.
write repay(uint256,uint256,address)
Repay debt: (reserveId, amount, onBehalfOf). Approve the underlying to the Spoke first. Returns (shares, assets) repaid. Reverts if the reserve is not listed.
write setUsingAsCollateral(uint256,bool,address)
Enable or disable a supplied reserve as collateral: (reserveId, usingAsCollateral, onBehalfOf). Reverts when enabling would exceed the maximum number of collateral reserves.
write updateUserRiskPremium(address)
Refresh the risk premium of a position: (onBehalfOf). Caller must be onBehalfOf, an approved position manager, or admin.
write setUserPositionManager(address,bool)
Approve or revoke a position manager for msg.sender: (positionManager, approve). A gateway such as the native token gateway needs approval before it can act for the user.
write liquidationCall(uint256,uint256,address,uint256,bool)
Liquidate an unhealthy position: (collateralReserveId, debtReserveId, user, debtToCover, receiveShares). The Spoke pulls the debt asset from the caller, so approve it first. receiveShares true returns collateral as supplied shares, false returns the underlying.
read getReserveId(address,uint256)
Reserve identifier in this Spoke for a Hub and asset id: (hub, assetId). Every Spoke call takes this reserveId.
read getUserAccountData(address)
Account summary for a user: (riskPremium, avgCollateralFactor, healthFactor, totalCollateralValue, totalDebtValueRay, activeCollateralCount, borrowCount). Check healthFactor before borrowing or withdrawing.
read getUserPosition(uint256,address)
Full position struct for one reserve and user: (reserveId, user).
read getUserSuppliedAssets(uint256,address)
Supplied underlying amount of a user in one reserve: (reserveId, user).
read getUserTotalDebt(uint256,address)
Total debt of a user in one reserve, in underlying units: (reserveId, user).
read getReserveSuppliedAssets(uint256)
Total supplied underlying for a reserve.
read getReserveTotalDebt(uint256)
Total debt for a reserve, in underlying units.
Core Hub (Avalanche)pool on avalanche0xd07369fAE4A5BB13c9Ce446B052c7867B1AbDf6e
read getAssetCount()
Number of assets listed in this Hub.
read getAssetDrawnRate(uint256)
Current drawn borrow rate for a Hub asset id. Check the Hub source for the unit.
read getAssetConfig(uint256)
Config struct of a Hub asset id.
read getAssetAccruedFees(uint256)
Accrued fees for a Hub asset id.
read getSpokeCount(uint256)
Number of Spokes connected to a Hub asset id.
read isSpokeListed(uint256,address)
True if a Spoke is listed for a Hub asset id: (assetId, spoke).
read getSpokeAddress(uint256,uint256)
Spoke address at an index for a Hub asset id: (assetId, index).
Main Spoke (Avalanche)pool on avalanche0x435272CefF93a1E657E8ABfdf0A13e95900A3a56
write supply(uint256,uint256,address)
Supply an asset to a reserve: (reserveId, amount, onBehalfOf). Approve the underlying to the Spoke first, since the Spoke pulls it from msg.sender. Returns (shares, assets). Caller must be onBehalfOf or an approved position manager. Reverts if the reserve is not listed.
write withdraw(uint256,uint256,address)
Withdraw supplied assets: (reserveId, amount, onBehalfOf). The underlying goes to msg.sender. An amount above the maximum withdrawable means a full withdrawal. Caller must be onBehalfOf or an approved position manager.
write borrow(uint256,uint256,address)
Borrow an asset: (reserveId, amount, onBehalfOf). The underlying goes to msg.sender. Needs enough collateral. Reverts if the reserve is not listed or the user would exceed the maximum number of borrowed reserves. Caller must be onBehalfOf or an approved position manager.
write repay(uint256,uint256,address)
Repay debt: (reserveId, amount, onBehalfOf). Approve the underlying to the Spoke first. Returns (shares, assets) repaid. Reverts if the reserve is not listed.
write setUsingAsCollateral(uint256,bool,address)
Enable or disable a supplied reserve as collateral: (reserveId, usingAsCollateral, onBehalfOf). Reverts when enabling would exceed the maximum number of collateral reserves.
write updateUserRiskPremium(address)
Refresh the risk premium of a position: (onBehalfOf). Caller must be onBehalfOf, an approved position manager, or admin.
write setUserPositionManager(address,bool)
Approve or revoke a position manager for msg.sender: (positionManager, approve). A gateway such as the native token gateway needs approval before it can act for the user.
write liquidationCall(uint256,uint256,address,uint256,bool)
Liquidate an unhealthy position: (collateralReserveId, debtReserveId, user, debtToCover, receiveShares). The Spoke pulls the debt asset from the caller, so approve it first. receiveShares true returns collateral as supplied shares, false returns the underlying.
read getReserveId(address,uint256)
Reserve identifier in this Spoke for a Hub and asset id: (hub, assetId). Every Spoke call takes this reserveId.
read getUserAccountData(address)
Account summary for a user: (riskPremium, avgCollateralFactor, healthFactor, totalCollateralValue, totalDebtValueRay, activeCollateralCount, borrowCount). Check healthFactor before borrowing or withdrawing.
read getUserPosition(uint256,address)
Full position struct for one reserve and user: (reserveId, user).
read getUserSuppliedAssets(uint256,address)
Supplied underlying amount of a user in one reserve: (reserveId, user).
read getUserTotalDebt(uint256,address)
Total debt of a user in one reserve, in underlying units: (reserveId, user).
read getReserveSuppliedAssets(uint256)
Total supplied underlying for a reserve.
read getReserveTotalDebt(uint256)
Total debt for a reserve, in underlying units.
Equities Hub (Base)pool on base0xa4d5947Eb727A052bae69C593FfC84247EC9864E
read getAssetCount()
Number of assets listed in this Hub.
read getAssetDrawnRate(uint256)
Current drawn borrow rate for a Hub asset id. Check the Hub source for the unit.
read getAssetConfig(uint256)
Config struct of a Hub asset id.
read getAssetAccruedFees(uint256)
Accrued fees for a Hub asset id.
read getSpokeCount(uint256)
Number of Spokes connected to a Hub asset id.
read isSpokeListed(uint256,address)
True if a Spoke is listed for a Hub asset id: (assetId, spoke).
read getSpokeAddress(uint256,uint256)
Spoke address at an index for a Hub asset id: (assetId, index).
MAG7 Spoke (Base)pool on base0x17905Db0e4A3514467539956c084180616AE7B8D
write supply(uint256,uint256,address)
Supply an asset to a reserve: (reserveId, amount, onBehalfOf). Approve the underlying to the Spoke first, since the Spoke pulls it from msg.sender. Returns (shares, assets). Caller must be onBehalfOf or an approved position manager. Reverts if the reserve is not listed.
write withdraw(uint256,uint256,address)
Withdraw supplied assets: (reserveId, amount, onBehalfOf). The underlying goes to msg.sender. An amount above the maximum withdrawable means a full withdrawal. Caller must be onBehalfOf or an approved position manager.
write borrow(uint256,uint256,address)
Borrow an asset: (reserveId, amount, onBehalfOf). The underlying goes to msg.sender. Needs enough collateral. Reverts if the reserve is not listed or the user would exceed the maximum number of borrowed reserves. Caller must be onBehalfOf or an approved position manager.
write repay(uint256,uint256,address)
Repay debt: (reserveId, amount, onBehalfOf). Approve the underlying to the Spoke first. Returns (shares, assets) repaid. Reverts if the reserve is not listed.
write setUsingAsCollateral(uint256,bool,address)
Enable or disable a supplied reserve as collateral: (reserveId, usingAsCollateral, onBehalfOf). Reverts when enabling would exceed the maximum number of collateral reserves.
write updateUserRiskPremium(address)
Refresh the risk premium of a position: (onBehalfOf). Caller must be onBehalfOf, an approved position manager, or admin.
write setUserPositionManager(address,bool)
Approve or revoke a position manager for msg.sender: (positionManager, approve). A gateway such as the native token gateway needs approval before it can act for the user.
write liquidationCall(uint256,uint256,address,uint256,bool)
Liquidate an unhealthy position: (collateralReserveId, debtReserveId, user, debtToCover, receiveShares). The Spoke pulls the debt asset from the caller, so approve it first. receiveShares true returns collateral as supplied shares, false returns the underlying.
read getReserveId(address,uint256)
Reserve identifier in this Spoke for a Hub and asset id: (hub, assetId). Every Spoke call takes this reserveId.
read getUserAccountData(address)
Account summary for a user: (riskPremium, avgCollateralFactor, healthFactor, totalCollateralValue, totalDebtValueRay, activeCollateralCount, borrowCount). Check healthFactor before borrowing or withdrawing.
read getUserPosition(uint256,address)
Full position struct for one reserve and user: (reserveId, user).
read getUserSuppliedAssets(uint256,address)
Supplied underlying amount of a user in one reserve: (reserveId, user).
read getUserTotalDebt(uint256,address)
Total debt of a user in one reserve, in underlying units: (reserveId, user).
read getReserveSuppliedAssets(uint256)
Total supplied underlying for a reserve.
read getReserveTotalDebt(uint256)
Total debt for a reserve, in underlying units.
NativeTokenGateway (Base)other on base0xdFC11f7037Ba11D9cC29A822844f5dC19C42B70d
write supplyNative(address,uint256,uint256)
Supply native token to a Spoke reserve: (spoke, reserveId, amount). Send the amount as msg.value. The gateway must be an approved position manager of the caller on that Spoke. Reverts with NativeAmountMismatch on a value mismatch.
write supplyAsCollateralNative(address,uint256,uint256)
Supply native token and enable it as collateral: (spoke, reserveId, amount). Send the amount as msg.value. Same approval rules as supplyNative.
write withdrawNative(address,uint256,uint256)
Withdraw native token from a Spoke reserve: (spoke, reserveId, amount). The gateway must be approved. May return less than requested if the user has insufficient supplied assets.
write borrowNative(address,uint256,uint256)
Borrow native token from a Spoke reserve: (spoke, reserveId, amount). The gateway must be approved.
write repayNative(address,uint256,uint256)
Repay native token debt: (spoke, reserveId, amount). Send the amount as msg.value. Any excess beyond the debt is refunded.
read NATIVE_TOKEN_WRAPPER()
Address of the wrapped native token the gateway uses.