Verified contractPartialMIT
AaveV4Ethereum_OnboardPAXGyGlobalDollarHub_20261026
Address0x550c8e5b3beadd81265a6fbabc71e6c5316ca1a0
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- shanghai
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,342,600
- Creation transaction
- 0xde69e9af94…6a8538a1ee
44 files
- src/20261026_AaveV4Ethereum_OnboardPAXGyGlobalDollarHub/AaveV4Ethereum_OnboardPAXGyGlobalDollarHub_20261026.solmain10.43 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/access/interfaces/IAccessManagerEnumerable.sol10.97 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/config-engine/AaveV4Payload.sol16.33 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/config-engine/interfaces/IAaveV4ConfigEngine.sol18.91 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/config-engine/libraries/EngineFlags.sol2.34 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/Address.sol6.37 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/Errors.sol864 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IAccessManaged.sol1.07 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IAccessManager.sol15.67 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC20.sol2.66 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC20Metadata.sol659 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC20Permit.sol3.7 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC2612.sol221 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC4626.sol11.8 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/LowLevelCall.sol5.18 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/deployments/utils/libraries/Roles.sol8.89 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IAssetInterestRateStrategy.sol4.68 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IBasicInterestRateStrategy.sol1.35 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IHub.sol19.89 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IHubBase.sol17.13 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IHubConfigurator.sol9.25 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IExtSload.sol694 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IIntentConsumer.sol475 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IMulticall.sol544 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/INoncesKeyed.sol1 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IRescuable.sol979 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IConfigPositionManager.sol12.34 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IGiverPositionManager.sol3.16 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/INativeTokenGateway.sol3.94 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IPositionManagerBase.sol3.69 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IPositionManagerIntentBase.sol462 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/ISignatureGateway.sol10.03 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/ITakerPositionManager.sol10.04 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/IAaveOracle.sol2.75 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/IPriceOracle.sol899 B
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ISpoke.sol38.72 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ISpokeConfigurator.sol9.03 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ITokenizationSpoke.sol7.91 KB
- lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ITreasurySpoke.sol2.84 KB
- lib/aave-helpers/lib/aave-address-book/src/AaveV4.sol1.55 KB
- lib/aave-helpers/lib/aave-address-book/src/AaveV4Ethereum.sol54.34 KB
- lib/aave-helpers/src/v4-config-engine/AaveV4PayloadEthereum.sol392 B
- lib/aave-helpers/src/v4-config-engine/V4EngineDefaults.sol1.88 KB
- lib/aave-helpers/src/v4-config-engine/V4RoleWiring.sol3.48 KB
src/20261026_AaveV4Ethereum_OnboardPAXGyGlobalDollarHub/AaveV4Ethereum_OnboardPAXGyGlobalDollarHub_20261026.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AaveV4Ethereum, AaveV4EthereumHubs, AaveV4EthereumIRStrategies, AaveV4EthereumSpokePriceFeeds, AaveV4EthereumSpokes, AaveV4EthereumAssets, AaveV4EthereumPositionManagers, AaveV4EthereumTokenizationSpokes} from 'aave-address-book/AaveV4Ethereum.sol';
import {AaveV4PayloadEthereum} from 'aave-helpers/src/v4-config-engine/AaveV4PayloadEthereum.sol';
import {IAaveV4ConfigEngine as IConfigEngine} from 'aave-address-book/AaveV4.sol';
import {EngineFlags} from 'aave-v4/config-engine/libraries/EngineFlags.sol';
import {IHub} from 'aave-v4/hub/interfaces/IHub.sol';
import {ISpoke} from 'aave-v4/spoke/interfaces/ISpoke.sol';
import {IAssetInterestRateStrategy} from 'aave-v4/hub/interfaces/IAssetInterestRateStrategy.sol';
import {V4EngineDefaults} from 'aave-helpers/src/v4-config-engine/V4EngineDefaults.sol';
import {V4RoleWiring} from 'aave-helpers/src/v4-config-engine/V4RoleWiring.sol';
/**
* @title Onboard PAXGy to Aave V4 Global Dollar Hub
* @author Aave Labs
* - Snapshot: https://snapshot.org/#/s:aavedao.eth/proposal/0xf987dd5aed6586169b232af7691e2cbb268cf61e2845bf6a04a83b60a5404bd8
* - Discussion: https://governance.aave.com/t/arfc-onboard-paxgy-to-aave-v4-global-dollar-hub/25499
*/
contract AaveV4Ethereum_OnboardPAXGyGlobalDollarHub_20261026 is AaveV4PayloadEthereum {
// https://etherscan.io/address/0x6c6494Fd9962eB98B94ffA48F6679058F820700e
address public constant PAXGY = 0x6c6494Fd9962eB98B94ffA48F6679058F820700e;
// https://etherscan.io/address/0x115aF1C2db26cD8ECa3f29055E4E424AF4edF616
address public constant PAXG_PAXOS_ESPOKE = 0x115aF1C2db26cD8ECa3f29055E4E424AF4edF616;
// https://etherscan.io/address/0x8E39De6366AB0bc3e9FF6a116f366736bf0D8A9e
address public constant PAXG_GOLD_SPOKE_PAXGY_PRICE_FEED =
0x8E39De6366AB0bc3e9FF6a116f366736bf0D8A9e;
function accessManagerTargetFunctionRoleUpdates()
public
pure
override
returns (IConfigEngine.TargetFunctionRoleUpdate[] memory)
{
return V4RoleWiring.spokeWiring(address(AaveV4Ethereum.ACCESS_MANAGER), PAXG_PAXOS_ESPOKE);
}
function hubAssetListings() public pure override returns (IConfigEngine.AssetListing[] memory) {
IConfigEngine.AssetListing[] memory items = new IConfigEngine.AssetListing[](1);
items[0] = IConfigEngine.AssetListing({
hubConfigurator: AaveV4Ethereum.HUB_CONFIGURATOR,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
underlying: PAXGY,
feeReceiver: address(AaveV4Ethereum.TREASURY_SPOKE),
liquidityFee: 0,
irStrategy: address(AaveV4EthereumIRStrategies.GLOBAL_DOLLAR_PAXG_IR_STRATEGY),
irData: V4EngineDefaults.nonBorrowableIRData(),
tokenization: V4EngineDefaults.noTokenization()
});
return items;
}
function spokeReserveListings()
public
pure
override
returns (IConfigEngine.ReserveListing[] memory)
{
IConfigEngine.ReserveListing[] memory items = new IConfigEngine.ReserveListing[](3);
items[0] = IConfigEngine.ReserveListing({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: address(AaveV4EthereumSpokes.PAXG_GOLD_SPOKE),
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
underlying: PAXGY,
priceSource: PAXG_GOLD_SPOKE_PAXGY_PRICE_FEED,
config: ISpoke.ReserveConfig({
collateralRisk: uint24(0),
paused: false,
frozen: false,
borrowable: false,
receiveSharesEnabled: true
}),
dynamicConfig: ISpoke.DynamicReserveConfig({
collateralFactor: uint16(70_00),
maxLiquidationBonus: uint32(107_50),
liquidationFee: uint16(10_00)
})
});
items[1] = IConfigEngine.ReserveListing({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
underlying: PAXGY,
priceSource: PAXG_GOLD_SPOKE_PAXGY_PRICE_FEED,
config: ISpoke.ReserveConfig({
collateralRisk: uint24(0),
paused: false,
frozen: false,
borrowable: false,
receiveSharesEnabled: true
}),
dynamicConfig: ISpoke.DynamicReserveConfig({
collateralFactor: uint16(85_00),
maxLiquidationBonus: uint32(104_00),
liquidationFee: uint16(10_00)
})
});
items[2] = IConfigEngine.ReserveListing({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
underlying: AaveV4EthereumAssets.PAXG_UNDERLYING,
priceSource: AaveV4EthereumSpokePriceFeeds.PAXG_GOLD_SPOKE_PAXG_PRICE_FEED,
config: ISpoke.ReserveConfig({
collateralRisk: uint24(0),
paused: false,
frozen: false,
borrowable: true,
receiveSharesEnabled: true
}),
dynamicConfig: ISpoke.DynamicReserveConfig({
collateralFactor: uint16(0),
maxLiquidationBonus: uint32(100_00),
liquidationFee: uint16(0)
})
});
return items;
}
function spokeLiquidationConfigUpdates()
public
pure
override
returns (IConfigEngine.LiquidationConfigUpdate[] memory)
{
IConfigEngine.LiquidationConfigUpdate[]
memory items = new IConfigEngine.LiquidationConfigUpdate[](1);
items[0] = IConfigEngine.LiquidationConfigUpdate({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
targetHealthFactor: 1.05e18,
healthFactorForMaxBonus: 0.99e18,
liquidationBonusFactor: 100_00
});
return items;
}
function hubSpokeToAssetsAdditions()
public
pure
override
returns (IConfigEngine.SpokeToAssetsAddition[] memory)
{
IConfigEngine.SpokeToAssetsAddition[] memory items = new IConfigEngine.SpokeToAssetsAddition[](
2
);
{
IConfigEngine.SpokeAssetConfig[] memory subAssets = new IConfigEngine.SpokeAssetConfig[](1);
subAssets[0] = IConfigEngine.SpokeAssetConfig({
underlying: PAXGY,
config: IHub.SpokeConfig({
addCap: 480,
drawCap: 0,
riskPremiumThreshold: 0,
active: true,
halted: false
})
});
items[0] = IConfigEngine.SpokeToAssetsAddition({
hubConfigurator: AaveV4Ethereum.HUB_CONFIGURATOR,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
spoke: address(AaveV4EthereumSpokes.PAXG_GOLD_SPOKE),
assets: subAssets
});
}
{
IConfigEngine.SpokeAssetConfig[] memory subAssets = new IConfigEngine.SpokeAssetConfig[](2);
subAssets[0] = IConfigEngine.SpokeAssetConfig({
underlying: PAXGY,
config: IHub.SpokeConfig({
addCap: 480,
drawCap: 0,
riskPremiumThreshold: 0,
active: true,
halted: false
})
});
subAssets[1] = IConfigEngine.SpokeAssetConfig({
underlying: AaveV4EthereumAssets.PAXG_UNDERLYING,
config: IHub.SpokeConfig({
addCap: 0,
drawCap: 400,
riskPremiumThreshold: 0,
active: true,
halted: false
})
});
items[1] = IConfigEngine.SpokeToAssetsAddition({
hubConfigurator: AaveV4Ethereum.HUB_CONFIGURATOR,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
spoke: PAXG_PAXOS_ESPOKE,
assets: subAssets
});
}
return items;
}
function spokePositionManagerUpdates()
public
pure
override
returns (IConfigEngine.PositionManagerUpdate[] memory)
{
IConfigEngine.PositionManagerUpdate[] memory items = new IConfigEngine.PositionManagerUpdate[](
4
);
items[0] = IConfigEngine.PositionManagerUpdate({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
positionManager: address(AaveV4EthereumPositionManagers.GIVER_POSITION_MANAGER),
active: true
});
items[1] = IConfigEngine.PositionManagerUpdate({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
positionManager: address(AaveV4EthereumPositionManagers.TAKER_POSITION_MANAGER),
active: true
});
items[2] = IConfigEngine.PositionManagerUpdate({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
positionManager: address(AaveV4EthereumPositionManagers.CONFIG_POSITION_MANAGER),
active: true
});
items[3] = IConfigEngine.PositionManagerUpdate({
spokeConfigurator: AaveV4Ethereum.SPOKE_CONFIGURATOR,
spoke: PAXG_PAXOS_ESPOKE,
positionManager: address(AaveV4EthereumPositionManagers.SIGNATURE_GATEWAY),
active: true
});
return items;
}
function hubAssetConfigUpdates()
public
pure
override
returns (IConfigEngine.AssetConfigUpdate[] memory)
{
IConfigEngine.AssetConfigUpdate[] memory items = new IConfigEngine.AssetConfigUpdate[](1);
items[0] = IConfigEngine.AssetConfigUpdate({
hubConfigurator: AaveV4Ethereum.HUB_CONFIGURATOR,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
underlying: AaveV4EthereumAssets.PAXG_UNDERLYING,
liquidityFee: 50_00,
feeReceiver: EngineFlags.KEEP_CURRENT_ADDRESS,
irStrategy: EngineFlags.KEEP_CURRENT_ADDRESS,
irData: IAssetInterestRateStrategy.InterestRateData({
optimalUsageRatio: uint16(60_00),
baseDrawnRate: uint32(0),
rateGrowthBeforeOptimal: uint32(3_00),
rateGrowthAfterOptimal: uint32(20_00)
}),
reinvestmentController: EngineFlags.KEEP_CURRENT_ADDRESS
});
return items;
}
function hubSpokeConfigUpdates()
public
pure
override
returns (IConfigEngine.SpokeConfigUpdate[] memory)
{
IConfigEngine.SpokeConfigUpdate[] memory items = new IConfigEngine.SpokeConfigUpdate[](1);
items[0] = IConfigEngine.SpokeConfigUpdate({
hubConfigurator: AaveV4Ethereum.HUB_CONFIGURATOR,
hub: address(AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB),
underlying: AaveV4EthereumAssets.PAXG_UNDERLYING,
spoke: address(AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_PAXG_TOKENIZATION_SPOKE),
addCap: 400,
drawCap: EngineFlags.KEEP_CURRENT,
riskPremiumThreshold: EngineFlags.KEEP_CURRENT,
active: EngineFlags.KEEP_CURRENT,
halted: EngineFlags.KEEP_CURRENT
});
return items;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/access/interfaces/IAccessManagerEnumerable.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IAccessManager} from 'src/dependencies/openzeppelin/IAccessManager.sol';
/// @title IAccessManagerEnumerable
/// @author Aave Labs
/// @notice Interface for AccessManagerEnumerable extension.
interface IAccessManagerEnumerable is IAccessManager {
/// @notice Thrown when the role has not been labeled.
error AccessManagerUnlabeledRole(uint64 roleId);
/// @notice Thrown when the label is not assigned to any role.
error AccessManagerUnregisteredLabel(string label);
/// @notice Thrown when the role has already been labeled.
error AccessManagerRoleAlreadyLabeled(uint64 roleId);
/// @notice Thrown when the label is already assigned to a different role.
error AccessManagerLabelAlreadyUsed(string label, uint64 roleId);
/// @notice Returns the identifier of the role at a specified index.
/// @dev `PUBLIC_ROLE` and `ADMIN_ROLE` are not accessible via any index.
/// @dev Roles with no assigned members are also accessible.
/// @param index The index in the role list.
/// @return The identifier of the role.
function getRole(uint256 index) external view returns (uint64);
/// @notice Returns the total number of existing roles.
/// @dev `PUBLIC_ROLE` and `ADMIN_ROLE` are not included in the role count.
/// @dev Roles with no assigned members are also taken into account.
/// @return The number of roles.
function getRoleCount() external view returns (uint256);
/// @notice Returns the list of role identifiers between the specified indexes.
/// @dev `PUBLIC_ROLE` and `ADMIN_ROLE` are not accessible via any index.
/// @dev Roles with no assigned members are also accessible.
/// @param start The starting index for the role list.
/// @param end The ending index for the role list.
/// @return The list of role identifiers.
function getRoles(uint256 start, uint256 end) external view returns (uint64[] memory);
/// @notice Returns whether the specified role exists.
/// @dev `PUBLIC_ROLE` and `ADMIN_ROLE` are not taken into account.
/// @param roleId The identifier of the role.
function isRole(uint64 roleId) external view returns (bool);
/// @notice Returns the identifier of the admin role at a specified index.
/// @dev `ADMIN_ROLE` is not accessible via any index.
/// @dev Admin roles with no assigned members or managed roles are also accessible.
/// @param index The index in the admin role list.
/// @return The identifier of the admin role.
function getAdminRole(uint256 index) external view returns (uint64);
/// @notice Returns the total number of existing admin roles.
/// @dev `ADMIN_ROLE` is not included in the admin role count.
/// @dev Admin roles with no assigned members or managed roles are also taken into account.
/// @return The number of admin roles.
function getAdminRoleCount() external view returns (uint256);
/// @notice Returns the list of admin role identifiers between the specified indexes.
/// @dev `ADMIN_ROLE` is not accessible via any index.
/// @dev Admin roles with no assigned members or managed roles are also accessible.
/// @param start The starting index for the admin role list.
/// @param end The ending index for the admin role list.
/// @return The list of admin role identifiers.
function getAdminRoles(uint256 start, uint256 end) external view returns (uint64[] memory);
/// @notice Returns whether the specified admin role exists.
/// @dev `ADMIN_ROLE` is not taken into account.
/// @param adminRoleId The identifier of the admin role.
function isAdminRole(uint64 adminRoleId) external view returns (bool);
/// @notice Returns the address of the role member at a specified index.
/// @param roleId The identifier of the role.
/// @param index The index in the role member list.
/// @return The address of the role member.
function getRoleMember(uint64 roleId, uint256 index) external view returns (address);
/// @notice Returns the number of members for a specified role.
/// @param roleId The identifier of the role.
/// @return The number of members for the role.
function getRoleMemberCount(uint64 roleId) external view returns (uint256);
/// @notice Returns the list of members for a specified role between the specified indexes.
/// @param roleId The identifier of the role.
/// @param start The starting index for the member list.
/// @param end The ending index for the member list.
/// @return The list of members for the role.
function getRoleMembers(
uint64 roleId,
uint256 start,
uint256 end
) external view returns (address[] memory);
/// @notice Returns the identifier of the role managed by the given admin role at a specified index.
/// @dev Roles managed by the `ADMIN_ROLE` are not accessible.
/// @param adminRoleId The identifier of the admin role.
/// @param index The index in the list of roles managed by the admin role.
/// @return The identifier of the role.
function getRoleOfAdminRole(uint64 adminRoleId, uint256 index) external view returns (uint64);
/// @notice Returns the number of roles managed by a specified admin role.
/// @dev Roles managed by the `ADMIN_ROLE` are not accessible.
/// @param adminRoleId The identifier of the admin role.
/// @return The number of roles managed by the admin role.
function getRoleOfAdminRoleCount(uint64 adminRoleId) external view returns (uint256);
/// @notice Returns the list of role identifiers managed by the given admin role between the specified indexes.
/// @dev Roles managed by the `ADMIN_ROLE` are not accessible.
/// @param adminRoleId The identifier of the admin role.
/// @param start The starting index in the list of roles managed by the admin role.
/// @param end The ending index in the list of roles managed by the admin role.
/// @return The list of role identifiers managed by the given admin role.
function getRolesOfAdminRole(
uint64 adminRoleId,
uint256 start,
uint256 end
) external view returns (uint64[] memory);
/// @notice Returns the address of the target contract for a specified role and index.
/// @dev Target contracts assigned to `ADMIN_ROLE` are not accessible.
/// @param roleId The identifier of the role.
/// @param index The index in the role target list.
/// @return The address of the target contract.
function getRoleTarget(uint64 roleId, uint256 index) external view returns (address);
/// @notice Returns the number of target contracts for a specified role.
/// @dev Target contracts assigned to `ADMIN_ROLE` are not accessible.
/// @param roleId The identifier of the role.
/// @return The number of target contracts for the role.
function getRoleTargetCount(uint64 roleId) external view returns (uint256);
/// @notice Returns the list of target contracts for a specified role between the specified indexes.
/// @dev Target contracts assigned to `ADMIN_ROLE` are not accessible.
/// @param roleId The identifier of the role.
/// @param start The starting index for the role target list.
/// @param end The ending index for the role target list.
/// @return The list of target contracts for the role.
function getRoleTargets(
uint64 roleId,
uint256 start,
uint256 end
) external view returns (address[] memory);
/// @notice Returns the function selector assigned to a given role at the specified index.
/// @dev Target selectors assigned to `ADMIN_ROLE` are not accessible.
/// @param roleId The identifier of the role.
/// @param target The address of the target contract.
/// @param index The index in the role member list.
/// @return The selector at the index.
function getRoleTargetSelector(
uint64 roleId,
address target,
uint256 index
) external view returns (bytes4);
/// @notice Returns the number of function selectors assigned to the given role.
/// @dev Target selectors assigned to `ADMIN_ROLE` are not accessible.
/// @param roleId The identifier of the role.
/// @param target The address of the target contract.
/// @return The number of selectors assigned to the role.
function getRoleTargetSelectorCount(
uint64 roleId,
address target
) external view returns (uint256);
/// @notice Returns the list of function selectors assigned to the given role between the specified indexes.
/// @dev Target selectors assigned to `ADMIN_ROLE` are not accessible.
/// @param roleId The identifier of the role.
/// @param target The address of the target contract.
/// @param start The starting index for the selector list.
/// @param end The ending index for the selector list.
/// @return The list of selectors assigned to the role.
function getRoleTargetSelectors(
uint64 roleId,
address target,
uint256 start,
uint256 end
) external view returns (bytes4[] memory);
/// @notice Returns the role identifier for the specified function selector.
/// @param target The address of the target contract.
/// @param selector The function selector.
/// @return The identifier of the role.
function getRoleOfTargetSelector(address target, bytes4 selector) external view returns (uint64);
/// @notice Returns the label at a specified index.
/// @param index The index in the labeled role list.
/// @return The label at the index.
function getRoleLabel(uint256 index) external view returns (string memory);
/// @notice Returns the total number of assigned role labels.
function getRoleLabelCount() external view returns (uint256);
/// @notice Returns the list of role labels between the specified indexes.
/// @param start The starting index for the labeled role list.
/// @param end The ending index for the labeled role list.
/// @return The list of role labels.
function getRoleLabels(uint256 start, uint256 end) external view returns (string[] memory);
/// @notice Returns whether the specified label is assigned to any tracked role.
/// @param label The label string.
function isLabelAssigned(string calldata label) external view returns (bool);
/// @notice Returns whether the given role has been labeled.
/// @param roleId The identifier of the role.
function isRoleLabeled(uint64 roleId) external view returns (bool);
/// @notice Returns the label of a specified role.
/// @dev `PUBLIC_ROLE` and `ADMIN_ROLE` cannot be labeled.
/// @dev Reverts with `AccessManagerUnlabeledRole` if the role has no assigned label.
/// @param roleId The identifier of the role.
/// @return The label of the role.
function getLabelOfRole(uint64 roleId) external view returns (string memory);
/// @notice Returns the role identifier for the specified label.
/// @dev Reverts with `AccessManagerUnregisteredLabel` if the label is not assigned to any role.
/// @param label The label string.
/// @return The identifier of the role.
function getRoleOfLabel(string calldata label) external view returns (uint64);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/config-engine/AaveV4Payload.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {Address} from 'src/dependencies/openzeppelin/Address.sol';
import {IAaveV4ConfigEngine} from 'src/config-engine/interfaces/IAaveV4ConfigEngine.sol';
/// @title AaveV4Payload
/// @author Aave Labs
/// @notice Abstract base payload contract for Aave V4 governance proposals.
abstract contract AaveV4Payload {
using Address for address;
/// @notice The config engine used to execute payload actions via delegatecall.
IAaveV4ConfigEngine public immutable CONFIG_ENGINE;
/// @dev Thrown when the config engine address is zero.
error InvalidConfigEngine();
/// @param configEngine_ The IAaveV4ConfigEngine implementation to delegatecall into.
constructor(IAaveV4ConfigEngine configEngine_) {
require(address(configEngine_) != address(0), InvalidConfigEngine());
CONFIG_ENGINE = configEngine_;
}
/// @notice Main execution entry point called by governance. Runs all configured actions.
/// @dev Expected to be called by a governance executor. No on-chain access control is applied;
/// the caller is responsible for authorization. Idempotency is not guaranteed.
function execute() external {
_preExecute();
_executeAccessManagerActions();
_executeHubActions();
_executeSpokeActions();
_executePositionManagerActions();
_postExecute();
}
/// @notice Returns the Hub asset listings to execute. Override to provide listings.
/// @return An array of AssetListing structs (empty by default).
function hubAssetListings()
public
view
virtual
returns (IAaveV4ConfigEngine.AssetListing[] memory)
{
return new IAaveV4ConfigEngine.AssetListing[](0);
}
/// @notice Returns the Hub asset config updates to execute. Override to provide updates.
/// @return An array of AssetConfigUpdate structs (empty by default).
function hubAssetConfigUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.AssetConfigUpdate[] memory)
{
return new IAaveV4ConfigEngine.AssetConfigUpdate[](0);
}
/// @notice Returns the Hub Spoke-to-assets additions to execute. Override to provide additions.
/// @return An array of SpokeToAssetsAddition structs (empty by default).
function hubSpokeToAssetsAdditions()
public
view
virtual
returns (IAaveV4ConfigEngine.SpokeToAssetsAddition[] memory)
{
return new IAaveV4ConfigEngine.SpokeToAssetsAddition[](0);
}
/// @notice Returns the Hub Spoke config updates to execute. Override to provide updates.
/// @return An array of SpokeConfigUpdate structs (empty by default).
function hubSpokeConfigUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.SpokeConfigUpdate[] memory)
{
return new IAaveV4ConfigEngine.SpokeConfigUpdate[](0);
}
/// @notice Returns the Hub asset halts to execute. Override to provide halts.
/// @return An array of AssetHalt structs (empty by default).
function hubAssetHalts() public view virtual returns (IAaveV4ConfigEngine.AssetHalt[] memory) {
return new IAaveV4ConfigEngine.AssetHalt[](0);
}
/// @notice Returns the Hub asset deactivations to execute. Override to provide deactivations.
/// @return An array of AssetDeactivation structs (empty by default).
function hubAssetDeactivations()
public
view
virtual
returns (IAaveV4ConfigEngine.AssetDeactivation[] memory)
{
return new IAaveV4ConfigEngine.AssetDeactivation[](0);
}
/// @notice Returns the Hub asset caps resets to execute. Override to provide resets.
/// @return An array of AssetCapsReset structs (empty by default).
function hubAssetCapsResets()
public
view
virtual
returns (IAaveV4ConfigEngine.AssetCapsReset[] memory)
{
return new IAaveV4ConfigEngine.AssetCapsReset[](0);
}
/// @notice Returns the Hub Spoke deactivations to execute. Override to provide deactivations.
/// @return An array of SpokeDeactivation structs (empty by default).
function hubSpokeDeactivations()
public
view
virtual
returns (IAaveV4ConfigEngine.SpokeDeactivation[] memory)
{
return new IAaveV4ConfigEngine.SpokeDeactivation[](0);
}
/// @notice Returns the Hub Spoke caps resets to execute. Override to provide resets.
/// @return An array of SpokeCapsReset structs (empty by default).
function hubSpokeCapsResets()
public
view
virtual
returns (IAaveV4ConfigEngine.SpokeCapsReset[] memory)
{
return new IAaveV4ConfigEngine.SpokeCapsReset[](0);
}
/// @notice Returns the Spoke reserve listings to execute. Override to provide listings.
/// @return An array of ReserveListing structs (empty by default).
function spokeReserveListings()
public
view
virtual
returns (IAaveV4ConfigEngine.ReserveListing[] memory)
{
return new IAaveV4ConfigEngine.ReserveListing[](0);
}
/// @notice Returns the Spoke reserve config updates to execute. Override to provide updates.
/// @return An array of ReserveConfigUpdate structs (empty by default).
function spokeReserveConfigUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.ReserveConfigUpdate[] memory)
{
return new IAaveV4ConfigEngine.ReserveConfigUpdate[](0);
}
/// @notice Returns the Spoke liquidation config updates to execute. Override to provide updates.
/// @return An array of LiquidationConfigUpdate structs (empty by default).
function spokeLiquidationConfigUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.LiquidationConfigUpdate[] memory)
{
return new IAaveV4ConfigEngine.LiquidationConfigUpdate[](0);
}
/// @notice Returns the Spoke dynamic reserve config additions to execute. Override to provide additions.
/// @return An array of DynamicReserveConfigAddition structs (empty by default).
function spokeDynamicReserveConfigAdditions()
public
view
virtual
returns (IAaveV4ConfigEngine.DynamicReserveConfigAddition[] memory)
{
return new IAaveV4ConfigEngine.DynamicReserveConfigAddition[](0);
}
/// @notice Returns the Spoke dynamic reserve config updates to execute. Override to provide updates.
/// @return An array of DynamicReserveConfigUpdate structs (empty by default).
function spokeDynamicReserveConfigUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.DynamicReserveConfigUpdate[] memory)
{
return new IAaveV4ConfigEngine.DynamicReserveConfigUpdate[](0);
}
/// @notice Returns the Spoke position manager updates to execute. Override to provide updates.
/// @return An array of PositionManagerUpdate structs (empty by default).
function spokePositionManagerUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.PositionManagerUpdate[] memory)
{
return new IAaveV4ConfigEngine.PositionManagerUpdate[](0);
}
/// @notice Returns the access manager role memberships to execute. Override to provide memberships.
/// @return An array of RoleMembership structs (empty by default).
function accessManagerRoleMemberships()
public
view
virtual
returns (IAaveV4ConfigEngine.RoleMembership[] memory)
{
return new IAaveV4ConfigEngine.RoleMembership[](0);
}
/// @notice Returns the access manager role updates to execute. Override to provide updates.
/// @return An array of RoleUpdate structs (empty by default).
function accessManagerRoleUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.RoleUpdate[] memory)
{
return new IAaveV4ConfigEngine.RoleUpdate[](0);
}
/// @notice Returns the access manager target function role updates to execute. Override to provide updates.
/// @return An array of TargetFunctionRoleUpdate structs (empty by default).
function accessManagerTargetFunctionRoleUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.TargetFunctionRoleUpdate[] memory)
{
return new IAaveV4ConfigEngine.TargetFunctionRoleUpdate[](0);
}
/// @notice Returns the access manager target admin delay updates to execute. Override to provide updates.
/// @return An array of TargetAdminDelayUpdate structs (empty by default).
function accessManagerTargetAdminDelayUpdates()
public
view
virtual
returns (IAaveV4ConfigEngine.TargetAdminDelayUpdate[] memory)
{
return new IAaveV4ConfigEngine.TargetAdminDelayUpdate[](0);
}
/// @notice Returns the position manager Spoke registrations to execute. Override to provide registrations.
/// @return An array of SpokeRegistration structs (empty by default).
function positionManagerSpokeRegistrations()
public
view
virtual
returns (IAaveV4ConfigEngine.SpokeRegistration[] memory)
{
return new IAaveV4ConfigEngine.SpokeRegistration[](0);
}
/// @notice Returns the position manager role renouncements to execute. Override to provide renouncements.
/// @return An array of PositionManagerRoleRenouncement structs (empty by default).
function positionManagerRoleRenouncements()
public
view
virtual
returns (IAaveV4ConfigEngine.PositionManagerRoleRenouncement[] memory)
{
return new IAaveV4ConfigEngine.PositionManagerRoleRenouncement[](0);
}
/// @notice Executes all hub-related configuration actions via delegatecall to the engine.
function _executeHubActions() internal {
IAaveV4ConfigEngine.AssetListing[] memory listings = hubAssetListings();
if (listings.length > 0) {
_delegateCallEngine(abi.encodeCall(IAaveV4ConfigEngine.executeHubAssetListings, (listings)));
}
IAaveV4ConfigEngine.AssetConfigUpdate[] memory assetConfigUpdates = hubAssetConfigUpdates();
if (assetConfigUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubAssetConfigUpdates, (assetConfigUpdates))
);
}
IAaveV4ConfigEngine.SpokeToAssetsAddition[]
memory spokeToAssetsAdds = hubSpokeToAssetsAdditions();
if (spokeToAssetsAdds.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubSpokeToAssetsAdditions, (spokeToAssetsAdds))
);
}
IAaveV4ConfigEngine.SpokeConfigUpdate[] memory spokeConfigUpdates = hubSpokeConfigUpdates();
if (spokeConfigUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubSpokeConfigUpdates, (spokeConfigUpdates))
);
}
IAaveV4ConfigEngine.AssetHalt[] memory assetHalts = hubAssetHalts();
if (assetHalts.length > 0) {
_delegateCallEngine(abi.encodeCall(IAaveV4ConfigEngine.executeHubAssetHalts, (assetHalts)));
}
IAaveV4ConfigEngine.AssetDeactivation[] memory assetDeactivations = hubAssetDeactivations();
if (assetDeactivations.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubAssetDeactivations, (assetDeactivations))
);
}
IAaveV4ConfigEngine.AssetCapsReset[] memory assetCapsResets = hubAssetCapsResets();
if (assetCapsResets.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubAssetCapsResets, (assetCapsResets))
);
}
IAaveV4ConfigEngine.SpokeDeactivation[] memory spokeDeactivations = hubSpokeDeactivations();
if (spokeDeactivations.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubSpokeDeactivations, (spokeDeactivations))
);
}
IAaveV4ConfigEngine.SpokeCapsReset[] memory spokeCapsResets = hubSpokeCapsResets();
if (spokeCapsResets.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeHubSpokeCapsResets, (spokeCapsResets))
);
}
}
/// @notice Executes all Spoke-related configuration actions via delegatecall to the engine.
function _executeSpokeActions() internal {
IAaveV4ConfigEngine.ReserveListing[] memory reserveListings = spokeReserveListings();
if (reserveListings.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeSpokeReserveListings, (reserveListings))
);
}
IAaveV4ConfigEngine.ReserveConfigUpdate[]
memory reserveConfigUpdates = spokeReserveConfigUpdates();
if (reserveConfigUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeSpokeReserveConfigUpdates, (reserveConfigUpdates))
);
}
IAaveV4ConfigEngine.LiquidationConfigUpdate[]
memory liqConfigUpdates = spokeLiquidationConfigUpdates();
if (liqConfigUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeSpokeLiquidationConfigUpdates, (liqConfigUpdates))
);
}
IAaveV4ConfigEngine.DynamicReserveConfigAddition[]
memory dynAdds = spokeDynamicReserveConfigAdditions();
if (dynAdds.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeSpokeDynamicReserveConfigAdditions, (dynAdds))
);
}
IAaveV4ConfigEngine.DynamicReserveConfigUpdate[]
memory dynUpdates = spokeDynamicReserveConfigUpdates();
if (dynUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeSpokeDynamicReserveConfigUpdates, (dynUpdates))
);
}
IAaveV4ConfigEngine.PositionManagerUpdate[] memory pmUpdates = spokePositionManagerUpdates();
if (pmUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeSpokePositionManagerUpdates, (pmUpdates))
);
}
}
/// @notice Executes all Access Manager configuration actions via delegatecall to the engine.
function _executeAccessManagerActions() internal {
IAaveV4ConfigEngine.RoleMembership[] memory memberships = accessManagerRoleMemberships();
if (memberships.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeRoleMemberships, (memberships))
);
}
IAaveV4ConfigEngine.RoleUpdate[] memory roleUpdates = accessManagerRoleUpdates();
if (roleUpdates.length > 0) {
_delegateCallEngine(abi.encodeCall(IAaveV4ConfigEngine.executeRoleUpdates, (roleUpdates)));
}
IAaveV4ConfigEngine.TargetFunctionRoleUpdate[]
memory fnRoleUpdates = accessManagerTargetFunctionRoleUpdates();
if (fnRoleUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeTargetFunctionRoleUpdates, (fnRoleUpdates))
);
}
IAaveV4ConfigEngine.TargetAdminDelayUpdate[]
memory targetDelayUpdates = accessManagerTargetAdminDelayUpdates();
if (targetDelayUpdates.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executeTargetAdminDelayUpdates, (targetDelayUpdates))
);
}
}
/// @notice Executes all Position Manager configuration actions via delegatecall to the engine.
/// @dev PositionManager Role renouncements happen before Spoke registrations: renouncing requires the
/// Spoke to still be registered on the position manager itself.
function _executePositionManagerActions() internal {
IAaveV4ConfigEngine.PositionManagerRoleRenouncement[]
memory renouncements = positionManagerRoleRenouncements();
if (renouncements.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executePositionManagerRoleRenouncements, (renouncements))
);
}
IAaveV4ConfigEngine.SpokeRegistration[] memory spokeRegs = positionManagerSpokeRegistrations();
if (spokeRegs.length > 0) {
_delegateCallEngine(
abi.encodeCall(IAaveV4ConfigEngine.executePositionManagerSpokeRegistrations, (spokeRegs))
);
}
}
/// @notice Delegatecalls the config engine with the given calldata.
/// @param data The ABI-encoded function call to forward to CONFIG_ENGINE.
/// @dev Bubbles up any revert reason from the engine call. Assumes the engine functions return no data.
function _delegateCallEngine(bytes memory data) internal {
address(CONFIG_ENGINE).functionDelegateCall(data);
}
/// @notice Hook called before executing any actions. Override to add pre-execution logic.
function _preExecute() internal virtual {}
/// @notice Hook called after executing all actions. Override to add post-execution logic.
function _postExecute() internal virtual {}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/config-engine/interfaces/IAaveV4ConfigEngine.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IHubConfigurator} from 'src/hub/interfaces/IHubConfigurator.sol';
import {ISpokeConfigurator} from 'src/spoke/interfaces/ISpokeConfigurator.sol';
import {IHub} from 'src/hub/interfaces/IHub.sol';
import {ISpoke} from 'src/spoke/interfaces/ISpoke.sol';
import {IAssetInterestRateStrategy} from 'src/hub/interfaces/IAssetInterestRateStrategy.sol';
/// @title IAaveV4ConfigEngine
/// @author Aave Labs
/// @notice Interface for the Aave V4 Config Engine, defining all structs and engine method signatures.
/// The engine is stateless and invoked via delegatecall from payload contracts.
/// All numeric fields in config structs use uint256 so that type(uint256).max can serve as
/// the universal KEEP_CURRENT sentinel. Boolean fields use uint256 (0=false, 1=true, KEEP_CURRENT=skip).
interface IAaveV4ConfigEngine {
/// @notice Parameters for tokenization of an asset on a Hub when listing the asset.
/// @dev Tokenization is skipped only when all fields are unset. Otherwise `name`, `symbol` and
/// `proxyAdminOwner` are all required; a partially set config reverts.
/// @dev addCap The add cap for the TokenizationSpoke.
/// @dev proxyAdminOwner The owner to set on the ProxyAdmin of the deployed TokenizationSpoke (address(0) when unset).
/// @dev name The name for the TokenizationSpoke ('' when unset).
/// @dev symbol The symbol for the TokenizationSpoke ('' when unset).
struct TokenizationSpokeConfig {
uint256 addCap;
address proxyAdminOwner;
string name;
string symbol;
}
/// @notice Parameters for listing a new asset on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev feeReceiver The address of the fee receiver Spoke.
/// @dev liquidityFee The liquidity fee of the asset, in BPS.
/// @dev irStrategy The address of the interest rate strategy contract.
/// @dev irData The interest rate data to apply to the given asset.
/// @dev tokenization The tokenization configuration for the asset.
struct AssetListing {
IHubConfigurator hubConfigurator;
address hub;
address underlying;
address feeReceiver;
uint256 liquidityFee;
address irStrategy;
IAssetInterestRateStrategy.InterestRateData irData;
TokenizationSpokeConfig tokenization;
}
/// @notice Parameters for updating asset config (fee, interest rate, reinvestment) on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev liquidityFee The new liquidity fee (KEEP_CURRENT to skip).
/// @dev feeReceiver The new fee receiver (KEEP_CURRENT_ADDRESS to skip).
/// @dev irStrategy The new interest rate strategy (KEEP_CURRENT_ADDRESS to skip strategy update).
/// @dev irData The interest rate data. If irStrategy != KEEP_CURRENT_ADDRESS, calls updateInterestRateStrategy.
/// Otherwise individual fields use KEEP_CURRENT_UINT16/KEEP_CURRENT_UINT32 sentinels;
/// non-sentinel fields trigger a read-modify-write via updateInterestRateData.
/// @dev reinvestmentController The new reinvestment controller (KEEP_CURRENT_ADDRESS to skip).
struct AssetConfigUpdate {
IHubConfigurator hubConfigurator;
address hub;
address underlying;
uint256 liquidityFee;
address feeReceiver;
address irStrategy;
IAssetInterestRateStrategy.InterestRateData irData;
address reinvestmentController;
}
/// @notice Pairs an underlying asset address with its Spoke configuration.
/// @dev underlying The address of the underlying asset.
/// @dev config The Spoke configuration for the asset.
struct SpokeAssetConfig {
address underlying;
IHub.SpokeConfig config;
}
/// @notice Parameters for registering a Spoke for multiple assets on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev spoke The address of the Spoke.
/// @dev assets The list of underlying assets with their Spoke configurations.
struct SpokeToAssetsAddition {
IHubConfigurator hubConfigurator;
address hub;
address spoke;
SpokeAssetConfig[] assets;
}
/// @notice Parameters for updating Spoke config (caps, risk premium threshold, status) on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev spoke The address of the Spoke.
/// @dev addCap The new add cap (KEEP_CURRENT to skip).
/// @dev drawCap The new draw cap (KEEP_CURRENT to skip).
/// @dev riskPremiumThreshold The new risk premium threshold (KEEP_CURRENT to skip).
/// @dev active New active flag (0=false, 1=true, KEEP_CURRENT=skip).
/// @dev halted New halted flag (0=false, 1=true, KEEP_CURRENT=skip).
struct SpokeConfigUpdate {
IHubConfigurator hubConfigurator;
address hub;
address underlying;
address spoke;
uint256 addCap;
uint256 drawCap;
uint256 riskPremiumThreshold;
uint256 active;
uint256 halted;
}
/// @notice Parameters for halting an asset on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
struct AssetHalt {
IHubConfigurator hubConfigurator;
address hub;
address underlying;
}
/// @notice Parameters for deactivating an asset on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
struct AssetDeactivation {
IHubConfigurator hubConfigurator;
address hub;
address underlying;
}
/// @notice Parameters for resetting asset caps on a Hub to 0.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
struct AssetCapsReset {
IHubConfigurator hubConfigurator;
address hub;
address underlying;
}
/// @notice Parameters for deactivating a Spoke on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev spoke The address of the Spoke.
struct SpokeDeactivation {
IHubConfigurator hubConfigurator;
address hub;
address spoke;
}
/// @notice Parameters for resetting Spoke caps on a Hub.
/// @dev hubConfigurator The HubConfigurator to use for this action.
/// @dev hub The address of the Hub.
/// @dev spoke The address of the Spoke.
struct SpokeCapsReset {
IHubConfigurator hubConfigurator;
address hub;
address spoke;
}
/// @notice Parameters for listing a new reserve on a Spoke.
/// @dev spokeConfigurator The SpokeConfigurator to use for this action.
/// @dev spoke The address of the Spoke.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev priceSource The address of the price source.
/// @dev config The configuration of the reserve.
/// @dev dynamicConfig The dynamic configuration of the reserve.
struct ReserveListing {
ISpokeConfigurator spokeConfigurator;
address spoke;
address hub;
address underlying;
address priceSource;
ISpoke.ReserveConfig config;
ISpoke.DynamicReserveConfig dynamicConfig;
}
/// @notice Parameters for updating reserve config on a Spoke.
/// @dev spokeConfigurator The SpokeConfigurator to use for this action.
/// @dev spoke The address of the Spoke.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev priceSource The new price source address (KEEP_CURRENT_ADDRESS to skip).
/// @dev collateralRisk New collateral risk (KEEP_CURRENT to skip).
/// @dev paused New paused flag (0=false, 1=true, KEEP_CURRENT=skip).
/// @dev frozen New frozen flag (0=false, 1=true, KEEP_CURRENT=skip).
/// @dev borrowable New borrowable flag (0=false, 1=true, KEEP_CURRENT=skip).
/// @dev receiveSharesEnabled New receiveSharesEnabled flag (0=false, 1=true, KEEP_CURRENT=skip).
struct ReserveConfigUpdate {
ISpokeConfigurator spokeConfigurator;
address spoke;
address hub;
address underlying;
address priceSource;
uint256 collateralRisk;
uint256 paused;
uint256 frozen;
uint256 borrowable;
uint256 receiveSharesEnabled;
}
/// @notice Parameters for updating liquidation config on a Spoke.
/// @dev spokeConfigurator The SpokeConfigurator to use for this action.
/// @dev spoke The address of the Spoke.
/// @dev targetHealthFactor The new target health factor (KEEP_CURRENT to skip).
/// @dev healthFactorForMaxBonus The new health factor for max bonus (KEEP_CURRENT to skip).
/// @dev liquidationBonusFactor The new liquidation bonus factor (KEEP_CURRENT to skip).
struct LiquidationConfigUpdate {
ISpokeConfigurator spokeConfigurator;
address spoke;
uint256 targetHealthFactor;
uint256 healthFactorForMaxBonus;
uint256 liquidationBonusFactor;
}
/// @notice Parameters for adding a dynamic reserve config on a Spoke.
/// @dev spokeConfigurator The SpokeConfigurator to use for this action.
/// @dev spoke The address of the Spoke.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev dynamicConfig The new dynamic config.
struct DynamicReserveConfigAddition {
ISpokeConfigurator spokeConfigurator;
address spoke;
address hub;
address underlying;
ISpoke.DynamicReserveConfig dynamicConfig;
}
/// @notice Parameters for updating a dynamic reserve config on a Spoke.
/// @dev spokeConfigurator The SpokeConfigurator to use for this action.
/// @dev spoke The address of the Spoke.
/// @dev hub The address of the Hub.
/// @dev underlying The address of the underlying asset.
/// @dev dynamicConfigKey The key of the dynamic config to update.
/// @dev collateralFactor New collateral factor (KEEP_CURRENT to skip).
/// @dev maxLiquidationBonus New max liquidation bonus (KEEP_CURRENT to skip).
/// @dev liquidationFee New liquidation fee (KEEP_CURRENT to skip).
struct DynamicReserveConfigUpdate {
ISpokeConfigurator spokeConfigurator;
address spoke;
address hub;
address underlying;
uint256 dynamicConfigKey;
uint256 collateralFactor;
uint256 maxLiquidationBonus;
uint256 liquidationFee;
}
/// @notice Parameters for updating a position manager on a Spoke.
/// @dev spokeConfigurator The SpokeConfigurator to use for this action.
/// @dev spoke The address of the Spoke.
/// @dev positionManager The address of the position manager.
/// @dev active The new active flag.
struct PositionManagerUpdate {
ISpokeConfigurator spokeConfigurator;
address spoke;
address positionManager;
bool active;
}
/// @notice Parameters for registering/deregistering a Spoke on a position manager.
/// @dev positionManager The position manager address.
/// @dev spoke The address of the Spoke.
/// @dev registered Whether to register (true) or deregister (false) the Spoke.
struct SpokeRegistration {
address positionManager;
address spoke;
bool registered;
}
/// @notice Parameters for renouncing the position manager role for a user on a Spoke.
/// @dev positionManager The position manager address.
/// @dev spoke The address of the Spoke.
/// @dev user The address of the user to renounce the role for.
struct PositionManagerRoleRenouncement {
address positionManager;
address spoke;
address user;
}
/// @notice Parameters for granting or revoking a role via AccessManager.
/// @dev When granted=true → grantRole(roleId, account, executionDelay).
/// @dev When granted=false → revokeRole(roleId, account). executionDelay is ignored.
/// @dev authority The AccessManager address.
/// @dev roleId The role identifier.
/// @dev account The account to grant/revoke the role to/from.
/// @dev granted Whether to grant (true) or revoke (false) the role.
/// @dev executionDelay The execution delay for the account (only used when granted=true).
struct RoleMembership {
address authority;
uint64 roleId;
address account;
bool granted;
uint32 executionDelay;
}
/// @notice Parameters for updating role configuration via AccessManager.
/// @dev Uses type-specific sentinels to skip fields: KEEP_CURRENT_UINT64 for admin/guardian,
/// KEEP_CURRENT_UINT32 for grantDelay, empty string for label.
/// @dev authority The AccessManager address.
/// @dev roleId The role identifier.
/// @dev admin The new admin role identifier (KEEP_CURRENT_UINT64 to skip).
/// @dev guardian The new guardian role identifier (KEEP_CURRENT_UINT64 to skip).
/// @dev grantDelay The new grant delay (KEEP_CURRENT_UINT32 to skip).
/// @dev label The label string (empty string to skip).
/// @dev labelUpdate Must be true to relabel an already-labeled role (clears the existing label first).
struct RoleUpdate {
address authority;
uint64 roleId;
uint64 admin;
uint64 guardian;
uint32 grantDelay;
string label;
bool labelUpdate;
}
/// @notice Parameters for setting target function roles via AccessManager.
/// @dev authority The AccessManager address.
/// @dev target The target contract address.
/// @dev selectors The function selectors.
/// @dev roleId The role identifier.
struct TargetFunctionRoleUpdate {
address authority;
address target;
bytes4[] selectors;
uint64 roleId;
}
/// @notice Parameters for setting target admin delay via AccessManager.
/// @dev authority The AccessManager address.
/// @dev target The target contract address.
/// @dev newDelay The new admin delay.
struct TargetAdminDelayUpdate {
address authority;
address target;
uint32 newDelay;
}
/// @notice Lists new assets on Hubs via the HubConfigurator.
/// @param listings The asset listings to execute.
function executeHubAssetListings(AssetListing[] calldata listings) external;
/// @notice Updates asset config (fee, interest rate, reinvestment) on Hubs.
/// @param updates The asset config updates to execute.
function executeHubAssetConfigUpdates(AssetConfigUpdate[] calldata updates) external;
/// @notice Registers Spokes for multiple assets on Hubs.
/// @param additions The Spoke-to-assets additions to execute.
function executeHubSpokeToAssetsAdditions(SpokeToAssetsAddition[] calldata additions) external;
/// @notice Updates Spoke config (caps, risk premium threshold, status) on Hubs.
/// @param updates The Spoke config updates to execute.
function executeHubSpokeConfigUpdates(SpokeConfigUpdate[] calldata updates) external;
/// @notice Halts assets on Hubs.
/// @param halts The asset halts to execute.
function executeHubAssetHalts(AssetHalt[] calldata halts) external;
/// @notice Deactivates assets on Hubs.
/// @param deactivations The asset deactivations to execute.
function executeHubAssetDeactivations(AssetDeactivation[] calldata deactivations) external;
/// @notice Resets asset caps on Hubs.
/// @param resets The asset caps resets to execute.
function executeHubAssetCapsResets(AssetCapsReset[] calldata resets) external;
/// @notice Deactivates Spokes on Hubs.
/// @param deactivations The Spoke deactivations to execute.
function executeHubSpokeDeactivations(SpokeDeactivation[] calldata deactivations) external;
/// @notice Resets Spoke caps on Hubs.
/// @param resets The Spoke caps resets to execute.
function executeHubSpokeCapsResets(SpokeCapsReset[] calldata resets) external;
/// @notice Lists new reserves on Spokes.
/// @param listings The reserve listings to execute.
function executeSpokeReserveListings(ReserveListing[] calldata listings) external;
/// @notice Updates reserve config on Spokes.
/// @param updates The reserve config updates to execute.
function executeSpokeReserveConfigUpdates(ReserveConfigUpdate[] calldata updates) external;
/// @notice Updates liquidation config on Spokes.
/// @param updates The liquidation config updates to execute.
function executeSpokeLiquidationConfigUpdates(
LiquidationConfigUpdate[] calldata updates
) external;
/// @notice Adds dynamic reserve configs on Spokes.
/// @param additions The dynamic reserve config additions to execute.
function executeSpokeDynamicReserveConfigAdditions(
DynamicReserveConfigAddition[] calldata additions
) external;
/// @notice Updates dynamic reserve configs on Spokes.
/// @param updates The dynamic reserve config updates to execute.
function executeSpokeDynamicReserveConfigUpdates(
DynamicReserveConfigUpdate[] calldata updates
) external;
/// @notice Updates position managers on Spokes.
/// @param updates The position manager updates to execute.
function executeSpokePositionManagerUpdates(PositionManagerUpdate[] calldata updates) external;
/// @notice Registers/deregisters Spokes on position managers.
/// @param registrations The Spoke registrations to execute.
function executePositionManagerSpokeRegistrations(
SpokeRegistration[] calldata registrations
) external;
/// @notice Renounces position manager roles for users on Spokes.
/// @param renouncements The role renouncements to execute.
function executePositionManagerRoleRenouncements(
PositionManagerRoleRenouncement[] calldata renouncements
) external;
/// @notice Grants or revokes roles via AccessManager.
/// @param memberships The role memberships to execute.
function executeRoleMemberships(RoleMembership[] calldata memberships) external;
/// @notice Updates role configuration (admin, guardian, grant delay, label) via AccessManager.
/// @dev Set labelUpdate to true to relabel an already-labeled role (the existing label is cleared
/// first); labeling an already-labeled role with labelUpdate false reverts.
/// Clearing a label without setting a new one requires a direct `labelRole` call.
/// @param updates The role updates to execute.
function executeRoleUpdates(RoleUpdate[] calldata updates) external;
/// @notice Updates target function roles via AccessManager.
/// @param updates The target function role updates to execute.
function executeTargetFunctionRoleUpdates(TargetFunctionRoleUpdate[] calldata updates) external;
/// @notice Updates target admin delays via AccessManager.
/// @param updates The target admin delay updates to execute.
function executeTargetAdminDelayUpdates(TargetAdminDelayUpdate[] calldata updates) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/config-engine/libraries/EngineFlags.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title EngineFlags
/// @author Aave Labs
/// @notice Sentinel values for partial updates in config engine structs.
library EngineFlags {
/// @dev Thrown when toBool receives a value other than 0 or 1.
error InvalidBoolValue(uint256 value);
/// @dev Sentinel value to keep the current uint value.
/// Strongly assumes that the value `type(uint256).max - 652` will never be used, which seems reasonable.
uint256 internal constant KEEP_CURRENT = type(uint256).max - 652;
/// @dev Sentinel address to keep the current address value.
address internal constant KEEP_CURRENT_ADDRESS = address(type(uint160).max);
/// @dev Sentinel value to keep the current uint64 value.
/// Strongly assumes that the value `type(uint64).max - 46` will never be used, which seems reasonable.
uint64 internal constant KEEP_CURRENT_UINT64 = type(uint64).max - 46;
/// @dev Sentinel value to keep the current uint32 value.
/// Strongly assumes that the value `type(uint32).max - 23` will never be used, which seems reasonable.
uint32 internal constant KEEP_CURRENT_UINT32 = type(uint32).max - 23;
/// @dev Sentinel value to keep the current uint16 value.
/// Strongly assumes that the value `type(uint16).max - 61` will never be used, which seems reasonable.
uint16 internal constant KEEP_CURRENT_UINT16 = type(uint16).max - 61;
/// @dev Convenience constant representing an enabled boolean flag (1).
uint256 internal constant ENABLED = 1;
/// @dev Convenience constant representing a disabled boolean flag (0).
uint256 internal constant DISABLED = 0;
/// @notice Converts a uint256 flag (0 or 1) to a bool.
/// @dev Reverts on any other value than the expected constants.
/// @param flag The uint256 flag to convert (must be 0 or 1).
/// @return The boolean representation of the flag.
function toBool(uint256 flag) internal pure returns (bool) {
require(flag == ENABLED || flag == DISABLED, InvalidBoolValue(flag));
return flag == ENABLED;
}
/// @notice Converts a bool to uint256 (false = DISABLED, true = ENABLED).
/// @param value The bool value to convert.
/// @return The uint256 representation of the value.
function fromBool(bool value) internal pure returns (uint256) {
return value ? ENABLED : DISABLED;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from './Errors.sol';
import {LowLevelCall} from './LowLevelCall.sol';
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
if (LowLevelCall.callNoReturn(recipient, amount, '')) {
// call successful, nothing to do
return;
} else if (LowLevelCall.returnDataSize() > 0) {
LowLevelCall.bubbleRevert();
} else {
revert Errors.FailedCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
bool success = LowLevelCall.callNoReturn(target, value, data);
if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {
return LowLevelCall.returnData();
} else if (success) {
revert AddressEmptyCode(target);
} else if (LowLevelCall.returnDataSize() > 0) {
LowLevelCall.bubbleRevert();
} else {
revert Errors.FailedCall();
}
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(
address target,
bytes memory data
) internal view returns (bytes memory) {
bool success = LowLevelCall.staticcallNoReturn(target, data);
if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {
return LowLevelCall.returnData();
} else if (success) {
revert AddressEmptyCode(target);
} else if (LowLevelCall.returnDataSize() > 0) {
LowLevelCall.bubbleRevert();
} else {
revert Errors.FailedCall();
}
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
bool success = LowLevelCall.delegatecallNoReturn(target, data);
if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {
return LowLevelCall.returnData();
} else if (success) {
revert AddressEmptyCode(target);
} else if (LowLevelCall.returnDataSize() > 0) {
LowLevelCall.bubbleRevert();
} else {
revert Errors.FailedCall();
}
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*
* NOTE: This function is DEPRECATED and may be removed in the next major release.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (success && (returndata.length > 0 || target.code.length > 0)) {
return returndata;
} else if (success) {
revert AddressEmptyCode(target);
} else if (returndata.length > 0) {
LowLevelCall.bubbleRevert(returndata);
} else {
revert Errors.FailedCall();
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(
bool success,
bytes memory returndata
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else if (returndata.length > 0) {
LowLevelCall.bubbleRevert(returndata);
} else {
revert Errors.FailedCall();
}
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IAccessManaged.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/manager/IAccessManaged.sol)
pragma solidity >=0.8.4;
interface IAccessManaged {
/**
* @dev Authority that manages this contract was updated.
*/
event AuthorityUpdated(address authority);
error AccessManagedUnauthorized(address caller);
error AccessManagedRequiredDelay(address caller, uint32 delay);
error AccessManagedInvalidAuthority(address authority);
/**
* @dev Returns the current authority.
*/
function authority() external view returns (address);
/**
* @dev Transfers control to a new authority. The caller must be the current authority.
*/
function setAuthority(address) external;
/**
* @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is
* being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs
* attacker controlled calls.
*/
function isConsumingScheduledOp() external view returns (bytes4);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IAccessManager.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (access/manager/IAccessManager.sol)
pragma solidity >=0.8.4;
interface IAccessManager {
/**
* @dev A delayed operation was scheduled.
*/
event OperationScheduled(
bytes32 indexed operationId,
uint32 indexed nonce,
uint48 schedule,
address caller,
address target,
bytes data
);
/**
* @dev A scheduled operation was executed.
*/
event OperationExecuted(bytes32 indexed operationId, uint32 indexed nonce);
/**
* @dev A scheduled operation was canceled.
*/
event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);
/**
* @dev Informational labelling for a roleId.
*/
event RoleLabel(uint64 indexed roleId, string label);
/**
* @dev Emitted when `account` is granted `roleId`.
*
* NOTE: The meaning of the `since` argument depends on the `newMember` argument.
* If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,
* otherwise it indicates the execution delay for this account and roleId is updated.
*/
event RoleGranted(
uint64 indexed roleId,
address indexed account,
uint32 delay,
uint48 since,
bool newMember
);
/**
* @dev Emitted when `account` membership or `roleId` is revoked. Unlike granting, revoking is instantaneous.
*/
event RoleRevoked(uint64 indexed roleId, address indexed account);
/**
* @dev Role acting as admin over a given `roleId` is updated.
*/
event RoleAdminChanged(uint64 indexed roleId, uint64 indexed admin);
/**
* @dev Role acting as guardian over a given `roleId` is updated.
*/
event RoleGuardianChanged(uint64 indexed roleId, uint64 indexed guardian);
/**
* @dev Grant delay for a given `roleId` will be updated to `delay` when `since` is reached.
*/
event RoleGrantDelayChanged(uint64 indexed roleId, uint32 delay, uint48 since);
/**
* @dev Target mode is updated (true = closed, false = open).
*/
event TargetClosed(address indexed target, bool closed);
/**
* @dev Role required to invoke `selector` on `target` is updated to `roleId`.
*/
event TargetFunctionRoleUpdated(address indexed target, bytes4 selector, uint64 indexed roleId);
/**
* @dev Admin delay for a given `target` will be updated to `delay` when `since` is reached.
*/
event TargetAdminDelayUpdated(address indexed target, uint32 delay, uint48 since);
error AccessManagerAlreadyScheduled(bytes32 operationId);
error AccessManagerNotScheduled(bytes32 operationId);
error AccessManagerNotReady(bytes32 operationId);
error AccessManagerExpired(bytes32 operationId);
error AccessManagerLockedRole(uint64 roleId);
error AccessManagerBadConfirmation();
error AccessManagerUnauthorizedAccount(address msgsender, uint64 roleId);
error AccessManagerUnauthorizedCall(address caller, address target, bytes4 selector);
error AccessManagerUnauthorizedConsume(address target);
error AccessManagerUnauthorizedCancel(
address msgsender,
address caller,
address target,
bytes4 selector
);
error AccessManagerInvalidInitialAdmin(address initialAdmin);
/**
* @dev Check if an address (`caller`) is authorised to call a given function on a given contract directly (with
* no restriction). Additionally, it returns the delay needed to perform the call indirectly through the {schedule}
* & {execute} workflow.
*
* This function is usually called by the targeted contract to control immediate execution of restricted functions.
* Therefore we only return true if the call can be performed without any delay. If the call is subject to a
* previously set delay (not zero), then the function should return false and the caller should schedule the operation
* for future execution.
*
* If `allowed` is true, the delay can be disregarded and the operation can be immediately executed, otherwise
* the operation can be executed if and only if delay is greater than 0.
*
* NOTE: The IAuthority interface does not include the `uint32` delay. This is an extension of that interface that
* is backward compatible. Some contracts may thus ignore the second return argument. In that case they will fail
* to identify the indirect workflow, and will consider calls that require a delay to be forbidden.
*
* NOTE: This function does not report the permissions of the admin functions in the manager itself. These are defined by the
* {AccessManager} documentation.
*/
function canCall(
address caller,
address target,
bytes4 selector
) external view returns (bool allowed, uint32 delay);
/**
* @dev Expiration delay for scheduled proposals. Defaults to 1 week.
*
* IMPORTANT: Avoid overriding the expiration with 0. Otherwise every contract proposal will be expired immediately,
* disabling any scheduling usage.
*/
function expiration() external view returns (uint32);
/**
* @dev Minimum setback for all delay updates, with the exception of execution delays. It
* can be increased without setback (and reset via {revokeRole} in the event of an
* accidental increase). Defaults to 5 days.
*/
function minSetback() external view returns (uint32);
/**
* @dev Get whether the contract is closed disabling any access. Otherwise role permissions are applied.
*
* NOTE: When the manager itself is closed, admin functions are still accessible to avoid locking the contract.
*/
function isTargetClosed(address target) external view returns (bool);
/**
* @dev Get the role required to call a function.
*/
function getTargetFunctionRole(address target, bytes4 selector) external view returns (uint64);
/**
* @dev Get the admin delay for a target contract. Changes to contract configuration are subject to this delay.
*/
function getTargetAdminDelay(address target) external view returns (uint32);
/**
* @dev Get the id of the role that acts as an admin for the given role.
*
* The admin permission is required to grant the role, revoke the role and update the execution delay to execute
* an operation that is restricted to this role.
*/
function getRoleAdmin(uint64 roleId) external view returns (uint64);
/**
* @dev Get the role that acts as a guardian for a given role.
*
* The guardian permission allows canceling operations that have been scheduled under the role.
*/
function getRoleGuardian(uint64 roleId) external view returns (uint64);
/**
* @dev Get the role current grant delay.
*
* Its value may change at any point without an event emitted following a call to {setGrantDelay}.
* Changes to this value, including effect timepoint are notified in advance by the {RoleGrantDelayChanged} event.
*/
function getRoleGrantDelay(uint64 roleId) external view returns (uint32);
/**
* @dev Get the access details for a given account for a given role. These details include the timepoint at which
* membership becomes active, and the delay applied to all operations by this user that requires this permission
* level.
*
* Returns:
* [0] Timestamp at which the account membership becomes valid. 0 means role is not granted.
* [1] Current execution delay for the account.
* [2] Pending execution delay for the account.
* [3] Timestamp at which the pending execution delay will become active. 0 means no delay update is scheduled.
*/
function getAccess(
uint64 roleId,
address account
) external view returns (uint48 since, uint32 currentDelay, uint32 pendingDelay, uint48 effect);
/**
* @dev Check if a given account currently has the permission level corresponding to a given role. Note that this
* permission might be associated with an execution delay. {getAccess} can provide more details.
*/
function hasRole(
uint64 roleId,
address account
) external view returns (bool isMember, uint32 executionDelay);
/**
* @dev Give a label to a role, for improved role discoverability by UIs.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {RoleLabel} event.
*/
function labelRole(uint64 roleId, string calldata label) external;
/**
* @dev Add `account` to `roleId`, or change its execution delay.
*
* This gives the account the authorization to call any function that is restricted to this role. An optional
* execution delay (in seconds) can be set. If that delay is non 0, the user is required to schedule any operation
* that is restricted to members of this role. The user will only be able to execute the operation after the delay has
* passed, before it has expired. During this period, admin and guardians can cancel the operation (see {cancel}).
*
* If the account has already been granted this role, the execution delay will be updated. This update is not
* immediate and follows the delay rules. For example, if a user currently has a delay of 3 hours, and this is
* called to reduce that delay to 1 hour, the new delay will take some time to take effect, enforcing that any
* operation executed in the 3 hours that follows this update was indeed scheduled before this update.
*
* Requirements:
*
* - the caller must be an admin for the role (see {getRoleAdmin})
* - granted role must not be the `PUBLIC_ROLE`
*
* Emits a {RoleGranted} event.
*/
function grantRole(uint64 roleId, address account, uint32 executionDelay) external;
/**
* @dev Remove an account from a role, with immediate effect. If the account does not have the role, this call has
* no effect.
*
* Requirements:
*
* - the caller must be an admin for the role (see {getRoleAdmin})
* - revoked role must not be the `PUBLIC_ROLE`
*
* Emits a {RoleRevoked} event if the account had the role.
*/
function revokeRole(uint64 roleId, address account) external;
/**
* @dev Renounce role permissions for the calling account with immediate effect. If the sender is not in
* the role this call has no effect.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* Emits a {RoleRevoked} event if the account had the role.
*/
function renounceRole(uint64 roleId, address callerConfirmation) external;
/**
* @dev Change admin role for a given role.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {RoleAdminChanged} event
*/
function setRoleAdmin(uint64 roleId, uint64 admin) external;
/**
* @dev Change guardian role for a given role.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {RoleGuardianChanged} event
*/
function setRoleGuardian(uint64 roleId, uint64 guardian) external;
/**
* @dev Update the delay for granting a `roleId`.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {RoleGrantDelayChanged} event.
*/
function setGrantDelay(uint64 roleId, uint32 newDelay) external;
/**
* @dev Set the role required to call functions identified by the `selectors` in the `target` contract.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {TargetFunctionRoleUpdated} event per selector.
*/
function setTargetFunctionRole(
address target,
bytes4[] calldata selectors,
uint64 roleId
) external;
/**
* @dev Set the delay for changing the configuration of a given target contract.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {TargetAdminDelayUpdated} event.
*/
function setTargetAdminDelay(address target, uint32 newDelay) external;
/**
* @dev Set the closed flag for a contract.
*
* Closing the manager itself won't disable access to admin methods to avoid locking the contract.
*
* Requirements:
*
* - the caller must be a global admin
*
* Emits a {TargetClosed} event.
*/
function setTargetClosed(address target, bool closed) external;
/**
* @dev Return the timepoint at which a scheduled operation will be ready for execution. This returns 0 if the
* operation is not yet scheduled, has expired, was executed, or was canceled.
*/
function getSchedule(bytes32 id) external view returns (uint48);
/**
* @dev Return the nonce for the latest scheduled operation with a given id. Returns 0 if the operation has never
* been scheduled.
*/
function getNonce(bytes32 id) external view returns (uint32);
/**
* @dev Schedule a delayed operation for future execution, and return the operation identifier. It is possible to
* choose the timestamp at which the operation becomes executable as long as it satisfies the execution delays
* required for the caller. The special value zero will automatically set the earliest possible time.
*
* Returns the `operationId` that was scheduled. Since this value is a hash of the parameters, it can reoccur when
* the same parameters are used; if this is relevant, the returned `nonce` can be used to uniquely identify this
* scheduled operation from other occurrences of the same `operationId` in invocations of {execute} and {cancel}.
*
* Emits a {OperationScheduled} event.
*
* NOTE: It is not possible to concurrently schedule more than one operation with the same `target` and `data`. If
* this is necessary, a random byte can be appended to `data` to act as a salt that will be ignored by the target
* contract if it is using standard Solidity ABI encoding.
*/
function schedule(
address target,
bytes calldata data,
uint48 when
) external returns (bytes32 operationId, uint32 nonce);
/**
* @dev Execute a function that is delay restricted, provided it was properly scheduled beforehand, or the
* execution delay is 0.
*
* Returns the nonce that identifies the previously scheduled operation that is executed, or 0 if the
* operation wasn't previously scheduled (if the caller doesn't have an execution delay).
*
* Emits an {OperationExecuted} event only if the call was scheduled and delayed.
*/
function execute(address target, bytes calldata data) external payable returns (uint32);
/**
* @dev Cancel a scheduled (delayed) operation. Returns the nonce that identifies the previously scheduled
* operation that is cancelled.
*
* Requirements:
*
* - the caller must be the proposer, a guardian of the targeted function, or a global admin
*
* Emits a {OperationCanceled} event.
*/
function cancel(address caller, address target, bytes calldata data) external returns (uint32);
/**
* @dev Consume a scheduled operation targeting the caller. If such an operation exists, mark it as consumed
* (emit an {OperationExecuted} event and clean the state). Otherwise, throw an error.
*
* This is useful for contracts that want to enforce that calls targeting them were scheduled on the manager,
* with all the verifications that it implies.
*
* Emit a {OperationExecuted} event.
*/
function consumeScheduledOp(address caller, bytes calldata data) external;
/**
* @dev Hashing function for delayed operations.
*/
function hashOperation(
address caller,
address target,
bytes calldata data
) external view returns (bytes32);
/**
* @dev Changes the authority of a target managed by this manager instance.
*
* Requirements:
*
* - the caller must be a global admin
*/
function updateAuthority(address target, address newAuthority) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20} from './IERC20.sol';
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC2612.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC2612.sol)
pragma solidity >=0.6.2;
import {IERC20Permit} from './IERC20Permit.sol';
interface IERC2612 is IERC20Permit {}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/IERC4626.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/IERC4626.sol)
pragma solidity >=0.6.2;
import {IERC20} from './IERC20.sol';
import {IERC20Metadata} from './IERC20Metadata.sol';
/**
* @dev Interface of the ERC-4626 "Tokenized Vault Standard", as defined in
* https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
*/
interface IERC4626 is IERC20, IERC20Metadata {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/**
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function asset() external view returns (address assetTokenAddress);
/**
* @dev Returns the total amount of the underlying asset that is “managed” by Vault.
*
* - SHOULD include any compounding that occurs from yield.
* - MUST be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT revert.
*/
function totalAssets() external view returns (uint256 totalManagedAssets);
/**
* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToShares(uint256 assets) external view returns (uint256 shares);
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
* through a deposit call.
*
* - MUST return a limited value if receiver is subject to some deposit limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
* - MUST NOT revert.
*/
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
* call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
* in the same transaction.
* - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
* deposit would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/**
* @dev Deposit `assets` underlying tokens and send the corresponding number of vault shares (`shares`) to `receiver`.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* deposit execution, and are accounted for during deposit.
* - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
* - MUST return a limited value if receiver is subject to some mint limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
* - MUST NOT revert.
*/
function maxMint(address receiver) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
* in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
* same transaction.
* - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
* would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by minting.
*/
function previewMint(uint256 shares) external view returns (uint256 assets);
/**
* @dev Mints exactly `shares` vault shares to `receiver` in exchange for `assets` underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
* execution, and are accounted for during mint.
* - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
* Vault, through a withdraw call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
* call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
* called
* in the same transaction.
* - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
* the withdrawal would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/**
* @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* withdraw execution, and are accounted for during withdraw.
* - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function withdraw(
uint256 assets,
address receiver,
address owner
) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
* through a redeem call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxRedeem(address owner) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their redemption at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
* in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
* same transaction.
* - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
* redemption would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by redeeming.
*/
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/**
* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* redeem execution, and are accounted for during redeem.
* - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function redeem(
uint256 shares,
address receiver,
address owner
) external returns (uint256 assets);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/dependencies/openzeppelin/LowLevelCall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/LowLevelCall.sol)
pragma solidity ^0.8.20;
/**
* @dev Library of low level call functions that implement different calling strategies to deal with the return data.
*
* WARNING: Using this library requires an advanced understanding of Solidity and how the EVM works. It is recommended
* to use the {Address} library instead.
*/
library LowLevelCall {
/// @dev Performs a Solidity function call using a low level `call` and ignoring the return data.
function callNoReturn(address target, bytes memory data) internal returns (bool success) {
return callNoReturn(target, 0, data);
}
/// @dev Same as {callNoReturn}, but allows to specify the value to be sent in the call.
function callNoReturn(
address target,
uint256 value,
bytes memory data
) internal returns (bool success) {
assembly ('memory-safe') {
success := call(gas(), target, value, add(data, 0x20), mload(data), 0x00, 0x00)
}
}
/// @dev Performs a Solidity function call using a low level `call` and returns the first 64 bytes of the result
/// in the scratch space of memory. Useful for functions that return a tuple of single-word values.
///
/// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated
/// and this function doesn't zero it out.
function callReturn64Bytes(
address target,
bytes memory data
) internal returns (bool success, bytes32 result1, bytes32 result2) {
return callReturn64Bytes(target, 0, data);
}
/// @dev Same as {callReturnBytes32Pair}, but allows to specify the value to be sent in the call.
function callReturn64Bytes(
address target,
uint256 value,
bytes memory data
) internal returns (bool success, bytes32 result1, bytes32 result2) {
assembly ('memory-safe') {
success := call(gas(), target, value, add(data, 0x20), mload(data), 0x00, 0x40)
result1 := mload(0x00)
result2 := mload(0x20)
}
}
/// @dev Performs a Solidity function call using a low level `staticcall` and ignoring the return data.
function staticcallNoReturn(
address target,
bytes memory data
) internal view returns (bool success) {
assembly ('memory-safe') {
success := staticcall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x00)
}
}
/// @dev Performs a Solidity function call using a low level `staticcall` and returns the first 64 bytes of the result
/// in the scratch space of memory. Useful for functions that return a tuple of single-word values.
///
/// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated
/// and this function doesn't zero it out.
function staticcallReturn64Bytes(
address target,
bytes memory data
) internal view returns (bool success, bytes32 result1, bytes32 result2) {
assembly ('memory-safe') {
success := staticcall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x40)
result1 := mload(0x00)
result2 := mload(0x20)
}
}
/// @dev Performs a Solidity function call using a low level `delegatecall` and ignoring the return data.
function delegatecallNoReturn(address target, bytes memory data) internal returns (bool success) {
assembly ('memory-safe') {
success := delegatecall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x00)
}
}
/// @dev Performs a Solidity function call using a low level `delegatecall` and returns the first 64 bytes of the result
/// in the scratch space of memory. Useful for functions that return a tuple of single-word values.
///
/// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated
/// and this function doesn't zero it out.
function delegatecallReturn64Bytes(
address target,
bytes memory data
) internal returns (bool success, bytes32 result1, bytes32 result2) {
assembly ('memory-safe') {
success := delegatecall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x40)
result1 := mload(0x00)
result2 := mload(0x20)
}
}
/// @dev Returns the size of the return data buffer.
function returnDataSize() internal pure returns (uint256 size) {
assembly ('memory-safe') {
size := returndatasize()
}
}
/// @dev Returns a buffer containing the return data from the last call.
function returnData() internal pure returns (bytes memory result) {
assembly ('memory-safe') {
result := mload(0x40)
mstore(result, returndatasize())
returndatacopy(add(result, 0x20), 0x00, returndatasize())
mstore(0x40, add(result, add(0x20, returndatasize())))
}
}
/// @dev Revert with the return data from the last call.
function bubbleRevert() internal pure {
assembly ('memory-safe') {
let fmp := mload(0x40)
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
}
function bubbleRevert(bytes memory returndata) internal pure {
assembly ('memory-safe') {
revert(add(returndata, 0x20), mload(returndata))
}
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/deployments/utils/libraries/Roles.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IHub} from 'src/hub/interfaces/IHub.sol';
import {ISpoke} from 'src/spoke/interfaces/ISpoke.sol';
import {IHubConfigurator} from 'src/hub/interfaces/IHubConfigurator.sol';
import {ISpokeConfigurator} from 'src/spoke/interfaces/ISpokeConfigurator.sol';
/// @title Roles library
/// @author Aave Labs
/// @notice Defines the different roles used by the protocol and their target selectors.
///
/// Role IDs are namespaced by domain:
/// - AccessManager: 0 (default admin)
/// - Hub: 100-199
/// - HubConfigurator: 200-299
/// - Spoke: 300-399
/// - SpokeConfigurator: 400-499
///
/// ## Role strategy
///
/// A single authority contract will be used to manage the roles for all applicable contracts on a given chain.
/// Role IDs, selector mappings, and overall configuration should be kept identical
/// across chains to avoid additional overhead and role divergence.
///
/// Hub and Spoke roles remain granular (e.g. HUB_CONFIGURATOR_ROLE,
/// HUB_FEE_MINTER_ROLE, HUB_DEFICIT_ELIMINATOR_ROLE each control a distinct set
/// of selectors).
///
/// HubConfigurator and SpokeConfigurator follow a different approach: initially,
/// a single Domain Admin role per domain (HUB_CONFIGURATOR_DOMAIN_ADMIN_ROLE = 200,
/// SPOKE_CONFIGURATOR_DOMAIN_ADMIN_ROLE = 400) holds all target selectors.
/// As more granular roles are introduced, they are added at the next available ID
/// (201, 202, ... / 401, 402, ...) and the corresponding selectors are reassigned
/// from the Domain Admin role to the new granular role:
/// - Existing role IDs should never be overwritten or reused for a different purpose.
/// - New roles are always appended with an incremented ID.
/// - The Domain Admin role (200/400) only ever has its selector set shrink over
/// time as selectors are divided into more granular roles.
/// - Addresses holding the Domain Admin role should be granted the new
/// granular role to retain their existing access.
library Roles {
// AccessManager roles
uint64 public constant ACCESS_MANAGER_ADMIN_ROLE = 0;
// Hub roles
uint64 public constant HUB_DOMAIN_ADMIN_ROLE = 100;
uint64 public constant HUB_CONFIGURATOR_ROLE = 101;
uint64 public constant HUB_FEE_MINTER_ROLE = 102;
uint64 public constant HUB_DEFICIT_ELIMINATOR_ROLE = 103;
// HubConfigurator roles — granularize as needed with new roles appended
uint64 public constant HUB_CONFIGURATOR_DOMAIN_ADMIN_ROLE = 200;
// Spoke roles
uint64 public constant SPOKE_DOMAIN_ADMIN_ROLE = 300;
uint64 public constant SPOKE_CONFIGURATOR_ROLE = 301;
uint64 public constant SPOKE_USER_POSITION_UPDATER_ROLE = 302;
// SpokeConfigurator roles — granularize as needed with new roles appended
uint64 public constant SPOKE_CONFIGURATOR_DOMAIN_ADMIN_ROLE = 400;
// ─── Hub selector getters ───
/// @notice Returns the function selectors associated with the Hub Configurator role.
function getHubConfiguratorRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](5);
selectors[0] = IHub.addAsset.selector;
selectors[1] = IHub.updateAssetConfig.selector;
selectors[2] = IHub.addSpoke.selector;
selectors[3] = IHub.updateSpokeConfig.selector;
selectors[4] = IHub.setInterestRateData.selector;
return selectors;
}
/// @notice Returns the function selectors associated with the Hub Fee Minter role.
function getHubFeeMinterRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](1);
selectors[0] = IHub.mintFeeShares.selector;
return selectors;
}
/// @notice Returns the function selectors associated with the Hub Deficit Eliminator role.
function getHubDeficitEliminatorRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](1);
selectors[0] = IHub.eliminateDeficit.selector;
return selectors;
}
// ─── HubConfigurator selector getters ───
/// @notice Returns the function selectors associated with the HubConfigurator Domain Admin role.
function getHubConfiguratorDomainAdminRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](22);
selectors[0] = IHubConfigurator.addAsset.selector;
selectors[1] = IHubConfigurator.addAssetWithDecimals.selector;
selectors[2] = IHubConfigurator.updateLiquidityFee.selector;
selectors[3] = IHubConfigurator.updateFeeReceiver.selector;
selectors[4] = IHubConfigurator.updateFeeConfig.selector;
selectors[5] = IHubConfigurator.updateInterestRateStrategy.selector;
selectors[6] = IHubConfigurator.updateReinvestmentController.selector;
selectors[7] = IHubConfigurator.resetAssetCaps.selector;
selectors[8] = IHubConfigurator.deactivateAsset.selector;
selectors[9] = IHubConfigurator.haltAsset.selector;
selectors[10] = IHubConfigurator.addSpoke.selector;
selectors[11] = IHubConfigurator.addSpokeToAssets.selector;
selectors[12] = IHubConfigurator.updateSpokeActive.selector;
selectors[13] = IHubConfigurator.updateSpokeHalted.selector;
selectors[14] = IHubConfigurator.updateSpokeAddCap.selector;
selectors[15] = IHubConfigurator.updateSpokeDrawCap.selector;
selectors[16] = IHubConfigurator.updateSpokeRiskPremiumThreshold.selector;
selectors[17] = IHubConfigurator.updateSpokeCaps.selector;
selectors[18] = IHubConfigurator.deactivateSpoke.selector;
selectors[19] = IHubConfigurator.haltSpoke.selector;
selectors[20] = IHubConfigurator.resetSpokeCaps.selector;
selectors[21] = IHubConfigurator.updateInterestRateData.selector;
return selectors;
}
// ─── Spoke selector getters ───
/// @notice Returns the function selectors associated with the Spoke Position Updater role.
function getSpokePositionUpdaterRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](2);
selectors[0] = ISpoke.updateUserDynamicConfig.selector;
selectors[1] = ISpoke.updateUserRiskPremium.selector;
return selectors;
}
/// @notice Returns the function selectors associated with the Spoke Configurator role.
function getSpokeConfiguratorRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](7);
selectors[0] = ISpoke.updateLiquidationConfig.selector;
selectors[1] = ISpoke.addReserve.selector;
selectors[2] = ISpoke.updateReserveConfig.selector;
selectors[3] = ISpoke.updateDynamicReserveConfig.selector;
selectors[4] = ISpoke.addDynamicReserveConfig.selector;
selectors[5] = ISpoke.updatePositionManager.selector;
selectors[6] = ISpoke.updateReservePriceSource.selector;
return selectors;
}
// ─── SpokeConfigurator selector getters ───
/// @notice Returns the function selectors associated with the SpokeConfigurator Domain Admin role.
function getSpokeConfiguratorDomainAdminRoleSelectors() internal pure returns (bytes4[] memory) {
bytes4[] memory selectors = new bytes4[](24);
selectors[0] = ISpokeConfigurator.updateReservePriceSource.selector;
selectors[1] = ISpokeConfigurator.updateLiquidationTargetHealthFactor.selector;
selectors[2] = ISpokeConfigurator.updateHealthFactorForMaxBonus.selector;
selectors[3] = ISpokeConfigurator.updateLiquidationBonusFactor.selector;
selectors[4] = ISpokeConfigurator.updateLiquidationConfig.selector;
selectors[5] = ISpokeConfigurator.addReserve.selector;
selectors[6] = ISpokeConfigurator.updatePaused.selector;
selectors[7] = ISpokeConfigurator.updateFrozen.selector;
selectors[8] = ISpokeConfigurator.updateBorrowable.selector;
selectors[9] = ISpokeConfigurator.updateReceiveSharesEnabled.selector;
selectors[10] = ISpokeConfigurator.updateCollateralRisk.selector;
selectors[11] = ISpokeConfigurator.addCollateralFactor.selector;
selectors[12] = ISpokeConfigurator.updateCollateralFactor.selector;
selectors[13] = ISpokeConfigurator.addMaxLiquidationBonus.selector;
selectors[14] = ISpokeConfigurator.updateMaxLiquidationBonus.selector;
selectors[15] = ISpokeConfigurator.addLiquidationFee.selector;
selectors[16] = ISpokeConfigurator.updateLiquidationFee.selector;
selectors[17] = ISpokeConfigurator.addDynamicReserveConfig.selector;
selectors[18] = ISpokeConfigurator.updateDynamicReserveConfig.selector;
selectors[19] = ISpokeConfigurator.pauseAllReserves.selector;
selectors[20] = ISpokeConfigurator.freezeAllReserves.selector;
selectors[21] = ISpokeConfigurator.pauseReserve.selector;
selectors[22] = ISpokeConfigurator.freezeReserve.selector;
selectors[23] = ISpokeConfigurator.updatePositionManager.selector;
return selectors;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IAssetInterestRateStrategy.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IBasicInterestRateStrategy} from 'src/hub/interfaces/IBasicInterestRateStrategy.sol';
/// @title IAssetInterestRateStrategy
/// @author Aave Labs
/// @notice Interface of the optimal-usage-based asset interest rate strategy.
interface IAssetInterestRateStrategy is IBasicInterestRateStrategy {
/// @notice Holds the interest rate data for a given asset.
/// @dev optimalUsageRatio The optimal usage ratio, in BPS. Maximum and minimum values are defined by `MAX_OPTIMAL_RATIO` and `MIN_OPTIMAL_RATIO`.
/// @dev baseDrawnRate The base drawn rate, in BPS.
/// @dev rateGrowthBeforeOptimal The rate growth before the optimal usage ratio, in BPS.
/// @dev rateGrowthAfterOptimal The rate growth after the optimal usage ratio, in BPS.
struct InterestRateData {
uint16 optimalUsageRatio;
uint32 baseDrawnRate;
uint32 rateGrowthBeforeOptimal;
uint32 rateGrowthAfterOptimal;
}
/// @notice Emitted when interest rate data is updated for an asset.
/// @param hub The address of the associated Hub.
/// @param assetId The identifier of the asset whose interest rate data is updated.
/// @param optimalUsageRatio The optimal usage ratio, in BPS.
/// @param baseDrawnRate The base drawn rate, in BPS.
/// @param rateGrowthBeforeOptimal The rate growth before the optimal usage ratio, in BPS.
/// @param rateGrowthAfterOptimal The rate growth after the optimal usage ratio, in BPS.
event UpdateInterestRateData(
address indexed hub,
uint256 indexed assetId,
uint256 optimalUsageRatio,
uint256 baseDrawnRate,
uint256 rateGrowthBeforeOptimal,
uint256 rateGrowthAfterOptimal
);
/// @notice Thrown when the given address is invalid.
error InvalidAddress();
/// @notice Thrown when the caller is not the Hub.
error OnlyHub();
/// @notice Thrown when the max possible rate is greater than `MAX_ALLOWED_DRAWN_RATE`.
error InvalidMaxDrawnRate();
/// @notice Thrown when the optimal usage ratio is less than `MIN_OPTIMAL_RATIO` or greater than `MAX_OPTIMAL_RATIO`.
error InvalidOptimalUsageRatio();
/// @notice Returns the full InterestRateData struct for the given asset.
/// @param assetId The identifier of the asset for which to get the data.
/// @return The InterestRateData struct for the given asset, all in BPS.
function getInterestRateData(uint256 assetId) external view returns (InterestRateData memory);
/// @notice Returns the optimal usage rate for the given asset.
/// @param assetId The identifier of the asset for which to get the optimal usage ratio.
/// @return The optimal usage ratio, in BPS.
function getOptimalUsageRatio(uint256 assetId) external view returns (uint256);
/// @notice Returns the base drawn rate.
/// @param assetId The identifier of the asset for which to get the base drawn rate.
/// @return The base drawn rate, in BPS.
function getBaseDrawnRate(uint256 assetId) external view returns (uint256);
/// @notice Returns the rate growth before the optimal usage ratio.
/// @dev Applicable when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO.
/// @param assetId The identifier of the asset for which to get the rate growth before the optimal usage ratio.
/// @return The rate growth, in BPS.
function getRateGrowthBeforeOptimal(uint256 assetId) external view returns (uint256);
/// @notice Returns the rate growth after the optimal usage ratio.
/// @dev Applicable when usage ratio > OPTIMAL_USAGE_RATIO.
/// @param assetId The identifier of the asset for which to get the rate growth after the optimal usage ratio.
/// @return The rate growth, in BPS.
function getRateGrowthAfterOptimal(uint256 assetId) external view returns (uint256);
/// @notice Returns the maximum drawn rate.
/// @param assetId The identifier of the asset for which to get the maximum drawn rate.
/// @return The maximum drawn rate, in BPS.
function getMaxDrawnRate(uint256 assetId) external view returns (uint256);
/// @notice Returns the maximum allowed value for a drawn rate.
/// @return The maximum drawn rate, in BPS.
function MAX_ALLOWED_DRAWN_RATE() external view returns (uint256);
/// @notice Returns the minimum optimal usage ratio.
/// @return The minimum optimal usage ratio, expressed in BPS.
function MIN_OPTIMAL_RATIO() external view returns (uint256);
/// @notice Returns the maximum optimal usage ratio.
/// @return The maximum optimal usage ratio, expressed in BPS.
function MAX_OPTIMAL_RATIO() external view returns (uint256);
/// @notice Returns the address of the Hub.
function HUB() external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IBasicInterestRateStrategy.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title IBasicInterestRateStrategy
/// @author Aave Labs
/// @notice Basic interface for any interest rate strategy.
interface IBasicInterestRateStrategy {
/// @notice Thrown when the interest rate data is not set for the asset.
/// @param assetId The identifier of the asset with no interest rate data set.
error InterestRateDataNotSet(uint256 assetId);
/// @notice Sets the interest rate parameters for a specified asset.
/// @param assetId The identifier of the asset.
/// @param data The encoded parameters used to configure the interest rate of the asset.
function setInterestRateData(uint256 assetId, bytes calldata data) external;
/// @notice Calculates the interest rate depending on the asset's state and configurations.
/// @param assetId The identifier of the asset.
/// @param liquidity The current available liquidity of the asset.
/// @param drawn The current drawn amount of the asset.
/// @param deficit The current deficit of the asset.
/// @param swept The current swept (reinvested) amount of the asset.
/// @return The interest rate, expressed in RAY.
function calculateInterestRate(
uint256 assetId,
uint256 liquidity,
uint256 drawn,
uint256 deficit,
uint256 swept
) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IHub.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IAccessManaged} from 'src/dependencies/openzeppelin/IAccessManaged.sol';
import {IHubBase} from 'src/hub/interfaces/IHubBase.sol';
/// @title IHub
/// @author Aave Labs
/// @notice Full interface for the Hub.
interface IHub is IHubBase, IAccessManaged {
/// @notice Asset position and configuration data.
/// @dev liquidity The liquidity available to be accessed, expressed in asset units.
/// @dev realizedFees The amount of fees realized but not yet minted, expressed in asset units.
/// @dev decimals The number of decimals of the underlying asset.
/// @dev addedShares The total shares added across all spokes.
/// @dev swept The outstanding liquidity which has been invested by the reinvestment controller, expressed in asset units.
/// @dev premiumOffsetRay The total premium offset across all spokes, used to calculate the premium, expressed in asset units and scaled by RAY.
/// @dev drawnShares The total drawn shares across all spokes.
/// @dev premiumShares The total premium shares across all spokes.
/// @dev liquidityFee The protocol fee charged on drawn and premium liquidity growth, expressed in BPS.
/// @dev drawnIndex The drawn index which monotonically increases according to the drawn rate, expressed in RAY.
/// @dev drawnRate The rate at which drawn assets grow, expressed in RAY.
/// @dev lastUpdateTimestamp The timestamp of the last accrual.
/// @dev underlying The address of the underlying asset.
/// @dev irStrategy The address of the interest rate strategy.
/// @dev reinvestmentController The address of the reinvestment controller.
/// @dev feeReceiver The address of the fee receiver spoke.
/// @dev deficitRay The amount of outstanding bad debt across all spokes, expressed in asset units and scaled by RAY.
struct Asset {
uint120 liquidity;
uint120 realizedFees;
uint8 decimals;
//
uint120 addedShares;
uint120 swept;
//
int200 premiumOffsetRay;
//
uint120 drawnShares;
uint120 premiumShares;
uint16 liquidityFee;
//
uint120 drawnIndex;
uint96 drawnRate;
uint40 lastUpdateTimestamp;
//
address underlying;
//
address irStrategy;
//
address reinvestmentController;
//
address feeReceiver;
//
uint200 deficitRay;
}
/// @notice Asset configuration. Subset of the `Asset` struct.
struct AssetConfig {
address feeReceiver;
uint16 liquidityFee;
address irStrategy;
address reinvestmentController;
}
/// @notice Spoke position and configuration data.
/// @dev drawnShares The drawn shares of a spoke for a given asset.
/// @dev premiumShares The premium shares of a spoke for a given asset.
/// @dev premiumOffsetRay The premium offset of a spoke for a given asset, used to calculate the premium, expressed in asset units and scaled by RAY.
/// @dev addedShares The added shares of a spoke for a given asset.
/// @dev addCap The maximum amount that can be added by a spoke, expressed in whole assets (not scaled by decimals). A value of `MAX_ALLOWED_SPOKE_CAP` indicates no cap.
/// @dev drawCap The maximum amount that can be drawn by a spoke, expressed in whole assets (not scaled by decimals). A value of `MAX_ALLOWED_SPOKE_CAP` indicates no cap.
/// @dev riskPremiumThreshold The maximum ratio of premium to drawn shares a spoke can have, expressed in BPS. A value of `MAX_RISK_PREMIUM_THRESHOLD` indicates no threshold.
/// @dev active True if the Spoke is allowed to perform any action.
/// @dev halted True if the Spoke is prevented from performing actions that instantly update liquidity.
/// @dev deficitRay The deficit reported by a spoke for a given asset, expressed in asset units and scaled by RAY.
struct SpokeData {
uint120 drawnShares;
uint120 premiumShares;
//
int200 premiumOffsetRay;
//
uint120 addedShares;
uint40 addCap;
uint40 drawCap;
uint24 riskPremiumThreshold;
bool active;
bool halted;
//
uint200 deficitRay;
}
/// @notice Spoke configuration data. Subset of the `SpokeData` struct.
struct SpokeConfig {
uint40 addCap;
uint40 drawCap;
uint24 riskPremiumThreshold;
bool active;
bool halted;
}
/// @notice Emitted when an asset is added.
/// @param assetId The identifier of the asset.
/// @param underlying The address of the underlying asset.
/// @param decimals The number of decimals of the asset.
event AddAsset(uint256 indexed assetId, address indexed underlying, uint8 decimals);
/// @notice Emitted when an asset is updated.
/// @param assetId The identifier of the asset.
/// @param drawnIndex The new drawn index of the asset.
/// @param drawnRate The new drawn rate of the asset.
/// @param accruedFees The accrued fees of the asset since the last mint.
event UpdateAsset(
uint256 indexed assetId,
uint256 drawnIndex,
uint256 drawnRate,
uint256 accruedFees
);
/// @notice Emitted when an asset configuration is updated.
/// @param assetId The identifier of the asset.
/// @param config The new asset configuration struct.
event UpdateAssetConfig(uint256 indexed assetId, AssetConfig config);
/// @notice Emitted when a spoke is added.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
event AddSpoke(uint256 indexed assetId, address indexed spoke);
/// @notice Emitted when a spoke configuration is updated.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param config The new spoke configuration struct.
event UpdateSpokeConfig(uint256 indexed assetId, address indexed spoke, SpokeConfig config);
/// @notice Emitted when fees are minted to the fee receiver spoke.
/// @param assetId The identifier of the asset.
/// @param feeReceiver The address of the current fee receiver spoke.
/// @param shares The amount of shares minted.
/// @param assets The amount of assets used to mint the shares.
event MintFeeShares(
uint256 indexed assetId,
address indexed feeReceiver,
uint256 shares,
uint256 assets
);
/// @notice Emitted when liquidity is invested by the reinvestment controller.
/// @param assetId The identifier of the asset.
/// @param reinvestmentController The active asset controller.
/// @param amount The amount invested.
event Sweep(uint256 indexed assetId, address indexed reinvestmentController, uint256 amount);
/// @notice Emitted when liquidity is reclaimed (from swept liquidity) by the reinvestment controller.
/// @param assetId The identifier of the asset.
/// @param reinvestmentController The active asset controller.
/// @param amount The amount reclaimed.
event Reclaim(uint256 indexed assetId, address indexed reinvestmentController, uint256 amount);
/// @notice Emitted when a deficit is eliminated.
/// @param assetId The identifier of the asset.
/// @param callerSpoke The spoke that eliminated the deficit using its added shares.
/// @param coveredSpoke The spoke for which the deficit was eliminated.
/// @param shares The amount of shares removed.
/// @param deficitAmountRay The amount of deficit eliminated, expressed in asset units and scaled by RAY.
event EliminateDeficit(
uint256 indexed assetId,
address indexed callerSpoke,
address indexed coveredSpoke,
uint256 shares,
uint256 deficitAmountRay
);
/// @notice Thrown when an underlying asset is already listed.
error UnderlyingAlreadyListed();
/// @notice Thrown when an asset is not listed.
error AssetNotListed();
/// @notice Thrown when the add cap is exceeded.
/// @param addCap The current `addCap` of the asset, expressed in whole assets (not scaled by decimals).
error AddCapExceeded(uint256 addCap);
/// @notice Thrown when the available liquidity is insufficient.
/// @param liquidity The current available liquidity.
error InsufficientLiquidity(uint256 liquidity);
/// @notice Thrown when the transferred liquidity is insufficient.
/// @param liquidityNeeded The amount of additional liquidity needed.
error InsufficientTransferred(uint256 liquidityNeeded);
/// @notice Thrown when the draw cap is exceeded.
/// @param drawCap The current `drawCap` of the asset, expressed in whole assets (not scaled by decimals).
error DrawCapExceeded(uint256 drawCap);
/// @notice Thrown when a surplus amount of drawn is restored.
/// @param maxAllowedRestore The maximum allowed drawn amount to restore.
error SurplusDrawnRestored(uint256 maxAllowedRestore);
/// @notice Thrown when a surplus amount of premium is restored.
/// @param maxAllowedRestoreRay The maximum allowed premium amount to restore, expressed in asset units and scaled by RAY.
error SurplusPremiumRayRestored(uint256 maxAllowedRestoreRay);
/// @notice Thrown when the premium change is invalid.
error InvalidPremiumChange();
/// @notice Thrown when a surplus amount of drawn is reported as deficit.
/// @param maxAllowedDeficit The maximum allowed drawn to report as deficit.
error SurplusDrawnDeficitReported(uint256 maxAllowedDeficit);
/// @notice Thrown when a surplus amount of premium is reported as deficit.
/// @param maxAllowedDeficitRay The maximum allowed premium to report as deficit, expressed in asset units and scaled by RAY.
error SurplusPremiumRayDeficitReported(uint256 maxAllowedDeficitRay);
/// @notice Thrown when a spoke is not active.
error SpokeNotActive();
/// @notice Thrown when a spoke is halted.
error SpokeHalted();
/// @notice Thrown when a new reinvestment controller is the zero address and the asset has existing swept liquidity.
error InvalidReinvestmentController();
/// @notice Thrown when an invalid reinvestment controller attempts to perform a `sweep` action.
error OnlyReinvestmentController();
/// @notice Thrown when a spoke being added is already listed.
error SpokeAlreadyListed();
/// @notice Thrown when a spoke being updated is not listed.
error SpokeNotListed();
/// @notice Thrown when the amount is invalid.
error InvalidAmount();
/// @notice Thrown when the shares amount is invalid.
error InvalidShares();
/// @notice Thrown when an input address is invalid.
error InvalidAddress();
/// @notice Thrown if the liquidity fee is invalid when updating an asset configuration.
error InvalidLiquidityFee();
/// @notice Thrown when the asset decimals exceed the maximum allowed decimals.
error InvalidAssetDecimals();
/// @notice Thrown if the interest rate strategy or data are invalid when updating an asset configuration.
/// @dev The `irData` must be empty if the interest rate strategy is not updated.
error InvalidInterestRateStrategy();
/// @notice Adds a new asset to the Hub.
/// @dev The same underlying asset address cannot be added as an asset multiple times.
/// @dev The fee receiver is added as a new spoke with maximum add cap and zero draw cap.
/// @param underlying The address of the underlying asset.
/// @param decimals The number of decimals of `underlying`.
/// @param feeReceiver The address of the fee receiver spoke.
/// @param irStrategy The address of the interest rate strategy contract.
/// @param irData The interest rate data to apply to the given asset encoded in bytes.
/// @return The unique identifier of the added asset.
function addAsset(
address underlying,
uint8 decimals,
address feeReceiver,
address irStrategy,
bytes calldata irData
) external returns (uint256);
/// @notice Updates the configuration of an asset.
/// @dev If the fee receiver is updated, adds it as a new spoke with maximum add cap and zero draw cap, and sets old fee receiver caps to zero.
/// @dev If the fee receiver is updated, accrued fees are minted as shares before the update if their value exceeds one share.
/// @dev If the interest rate strategy is updated, it is configured with `irData`. Otherwise, `irData` must be empty.
/// @param assetId The identifier of the asset.
/// @param config The new configuration for the asset.
/// @param irData The interest rate data to apply to the given asset, encoded in bytes.
function updateAssetConfig(
uint256 assetId,
AssetConfig calldata config,
bytes calldata irData
) external;
/// @notice Registers a new spoke for a specific asset in the Hub.
/// @dev Reverts with `SpokeAlreadyListed` if spoke is already listed.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke to add.
/// @param params The configuration parameters for the Spoke.
function addSpoke(uint256 assetId, address spoke, SpokeConfig calldata params) external;
/// @notice Updates the configuration of a spoke for a specific asset.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke to update.
/// @param config The new configuration for the Spoke.
function updateSpokeConfig(uint256 assetId, address spoke, SpokeConfig calldata config) external;
/// @notice Updates the interest rate strategy for a specified asset.
/// @param assetId The identifier of the asset.
/// @param irData The interest rate data to apply to the given asset, encoded in bytes.
function setInterestRateData(uint256 assetId, bytes calldata irData) external;
/// @notice Mints shares to the fee receiver from accrued fees.
/// @dev No op when fees are worth less than one share.
/// @param assetId The identifier of the asset.
/// @return The amount of shares minted.
function mintFeeShares(uint256 assetId) external returns (uint256);
/// @notice Eliminates deficit by removing added shares of caller spoke.
/// @dev Only callable by active and authorized spokes.
/// @param assetId The identifier of the asset.
/// @param amount The amount of deficit to eliminate.
/// @param spoke The spoke for which the deficit is eliminated.
/// @return The amount of added shares removed.
/// @return The amount of deficit eliminated, expressed in asset units.
function eliminateDeficit(
uint256 assetId,
uint256 amount,
address spoke
) external returns (uint256, uint256);
/// @notice Allows a spoke to transfer its added shares of an asset to another spoke.
/// @dev Only callable by spokes.
/// @param assetId The identifier of the asset.
/// @param shares The amount of shares to move.
/// @param toSpoke The address of the recipient spoke.
function transferShares(uint256 assetId, uint256 shares, address toSpoke) external;
/// @notice Sweeps an amount of liquidity of the corresponding asset and sends it to the configured reinvestment controller.
/// @dev The controller handles the actual reinvestment of funds, redistribution of interest, and investment caps.
/// @param assetId The identifier of the asset.
/// @param amount The amount to sweep.
function sweep(uint256 assetId, uint256 amount) external;
/// @notice Reclaims an amount of liquidity of the corresponding asset from the configured reinvestment controller.
/// @dev The controller can only reclaim up to swept amount. All accrued interest is distributed offchain.
/// @dev Underlying assets must be transferred to the Hub before invocation.
/// @dev Extra untracked underlying liquidity in the Hub can be skimmed into the Hub's liquidity accounting through this action.
/// @param assetId The identifier of the asset.
/// @param amount The amount to reclaim.
function reclaim(uint256 assetId, uint256 amount) external;
/// @notice Returns whether the underlying is listed as an asset.
/// @param underlying The address of the underlying asset.
/// @return True if the underlying asset is listed.
function isUnderlyingListed(address underlying) external view returns (bool);
/// @notice Returns the number of listed assets.
function getAssetCount() external view returns (uint256);
/// @notice Returns information regarding the specified asset.
/// @dev `drawnIndex`, `drawnRate` and `lastUpdateTimestamp` can be outdated due to passage of time.
/// @param assetId The identifier of the asset.
/// @return The asset struct.
function getAsset(uint256 assetId) external view returns (Asset memory);
/// @notice Returns the asset configuration for the specified asset.
/// @param assetId The identifier of the asset.
/// @return The asset configuration struct.
function getAssetConfig(uint256 assetId) external view returns (AssetConfig memory);
/// @notice Returns the accrued fees for the asset, expressed in asset units.
/// @dev Accrued fees are excluded from total added assets.
/// @param assetId The identifier of the asset.
/// @return The amount of accrued fees.
function getAssetAccruedFees(uint256 assetId) external view returns (uint256);
/// @notice Returns the amount of liquidity swept by the reinvestment controller for the specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of liquidity swept.
function getAssetSwept(uint256 assetId) external view returns (uint256);
/// @notice Calculates the current drawn rate for the specified asset.
/// @param assetId The identifier of the asset.
/// @return The current drawn rate of the asset.
function getAssetDrawnRate(uint256 assetId) external view returns (uint256);
/// @notice Returns the number of spokes listed for the specified asset.
/// @param assetId The identifier of the asset.
function getSpokeCount(uint256 assetId) external view returns (uint256);
/// @notice Returns whether the Spoke is listed for the specified asset.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return True if the Spoke is listed.
function isSpokeListed(uint256 assetId, address spoke) external view returns (bool);
/// @notice Returns the address of the Spoke for an asset at the given index.
/// @param assetId The identifier of the asset.
/// @param index The index of the Spoke.
/// @return The address of the Spoke.
function getSpokeAddress(uint256 assetId, uint256 index) external view returns (address);
/// @notice Returns the Spoke data struct.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The spoke data struct.
function getSpoke(uint256 assetId, address spoke) external view returns (SpokeData memory);
/// @notice Returns the Spoke configuration struct.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The spoke configuration struct.
function getSpokeConfig(
uint256 assetId,
address spoke
) external view returns (SpokeConfig memory);
/// @notice Returns the maximum allowed number of decimals for the underlying asset.
/// @return The maximum number of decimals (inclusive).
function MAX_ALLOWED_UNDERLYING_DECIMALS() external view returns (uint8);
/// @notice Returns the minimum allowed number of decimals for the underlying asset.
/// @return The minimum number of decimals (inclusive).
function MIN_ALLOWED_UNDERLYING_DECIMALS() external view returns (uint8);
/// @notice Returns the maximum value for any spoke cap (add or draw).
/// @dev The value is not inclusive; using the maximum value indicates no cap.
/// @return The maximum cap value, expressed in asset units.
function MAX_ALLOWED_SPOKE_CAP() external view returns (uint40);
/// @notice Returns the maximum value for any spoke risk premium threshold.
/// @dev The value is not inclusive; using the maximum value indicates no threshold.
/// @return The maximum risk premium threshold, expressed in BPS.
function MAX_RISK_PREMIUM_THRESHOLD() external view returns (uint24);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IHubBase.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title IHubBase
/// @author Aave Labs
/// @notice Minimal interface for Hub.
interface IHubBase {
/// @notice Changes to premium owed accounting.
/// @dev sharesDelta The change in premium shares.
/// @dev offsetRayDelta The change in premium offset, expressed in asset units and scaled by RAY.
/// @dev restoredPremiumRay The restored premium, expressed in asset units and scaled by RAY.
struct PremiumDelta {
int256 sharesDelta;
int256 offsetRayDelta;
uint256 restoredPremiumRay;
}
/// @notice Emitted on the `add` action.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param shares The amount of shares added.
/// @param amount The amount of assets added.
event Add(uint256 indexed assetId, address indexed spoke, uint256 shares, uint256 amount);
/// @notice Emitted on the `remove` action.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param shares The amount of shares removed.
/// @param amount The amount of assets removed.
event Remove(uint256 indexed assetId, address indexed spoke, uint256 shares, uint256 amount);
/// @notice Emitted on the `draw` action.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param drawnShares The amount of drawn shares.
/// @param drawnAmount The amount of drawn assets.
event Draw(
uint256 indexed assetId,
address indexed spoke,
uint256 drawnShares,
uint256 drawnAmount
);
/// @notice Emitted on the `restore` action.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param drawnShares The amount of drawn shares.
/// @param premiumDelta The premium delta data struct.
/// @param drawnAmount The amount of drawn assets restored.
/// @param premiumAmount The amount of premium assets restored.
event Restore(
uint256 indexed assetId,
address indexed spoke,
uint256 drawnShares,
PremiumDelta premiumDelta,
uint256 drawnAmount,
uint256 premiumAmount
);
/// @notice Emitted on the `refreshPremium` action.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param premiumDelta The premium delta data struct.
event RefreshPremium(uint256 indexed assetId, address indexed spoke, PremiumDelta premiumDelta);
/// @notice Emitted on the `reportDeficit` action.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param drawnShares The amount of drawn shares reported as deficit.
/// @param premiumDelta The premium delta data struct.
/// @param deficitAmountRay The amount of deficit reported, expressed in asset units and scaled by RAY.
event ReportDeficit(
uint256 indexed assetId,
address indexed spoke,
uint256 drawnShares,
PremiumDelta premiumDelta,
uint256 deficitAmountRay
);
/// @notice Emitted on the `transferShares` action.
/// @param assetId The identifier of the asset.
/// @param sender The address of the sender.
/// @param receiver The address of the receiver.
/// @param shares The amount of shares transferred.
event TransferShares(
uint256 indexed assetId,
address indexed sender,
address indexed receiver,
uint256 shares
);
/// @notice Adds assets on behalf of a user.
/// @dev Only callable by active spokes.
/// @dev Underlying assets must be transferred to the Hub before invocation.
/// @dev Extra untracked underlying liquidity in the Hub can be skimmed into the Hub's liquidity accounting through this action.
/// @param assetId The identifier of the asset.
/// @param amount The amount of asset liquidity to add.
/// @return The amount of shares added.
function add(uint256 assetId, uint256 amount) external returns (uint256);
/// @notice Removes assets on behalf of a user.
/// @dev Only callable by active spokes.
/// @param assetId The identifier of the asset.
/// @param amount The amount of asset liquidity to remove.
/// @param to The address to transfer the assets to.
/// @return The amount of shares removed.
function remove(uint256 assetId, uint256 amount, address to) external returns (uint256);
/// @notice Draws assets on behalf of a user.
/// @dev Only callable by active spokes.
/// @param assetId The identifier of the asset.
/// @param amount The amount of assets to draw.
/// @param to The address to transfer the underlying assets to.
/// @return The amount of drawn shares.
function draw(uint256 assetId, uint256 amount, address to) external returns (uint256);
/// @notice Restores assets on behalf of a user.
/// @dev Only callable by active spokes.
/// @dev Interest is always paid off first from premium, then from drawn.
/// @dev Underlying assets must be transferred to the Hub before invocation.
/// @dev Extra untracked underlying liquidity in the Hub can be skimmed into the Hub's liquidity accounting through this action.
/// @param assetId The identifier of the asset.
/// @param drawnAmount The drawn amount to restore.
/// @param premiumDelta The premium delta to apply which signals premium repayment.
/// @return The amount of drawn shares restored.
function restore(
uint256 assetId,
uint256 drawnAmount,
PremiumDelta calldata premiumDelta
) external returns (uint256);
/// @notice Reports an owed amount by the caller Spoke as a deficit.
/// @dev Only callable by active spokes.
/// @param assetId The identifier of the asset.
/// @param drawnAmount The drawn amount to report as deficit.
/// @param premiumDelta The premium delta to apply which signals premium deficit.
/// @return The amount of drawn shares reported as deficit.
/// @return The amount of deficit reported, expressed in asset units.
function reportDeficit(
uint256 assetId,
uint256 drawnAmount,
PremiumDelta calldata premiumDelta
) external returns (uint256, uint256);
/// @notice Refreshes premium accounting.
/// @dev Only callable by active spokes.
/// @dev Asset and spoke premium should not decrease.
/// @param assetId The identifier of the asset.
/// @param premiumDelta The change in premium.
function refreshPremium(uint256 assetId, PremiumDelta calldata premiumDelta) external;
/// @notice Transfers an amount of added shares of the caller Spoke to the fee receiver Spoke.
/// @dev It can be used to execute one-time payments to the fee receiver Spoke (e.g., liquidation fees).
/// @dev Only callable by active spokes.
/// @param assetId The identifier of the asset.
/// @param shares The amount of shares to pay to feeReceiver.
function payFeeShares(uint256 assetId, uint256 shares) external;
/// @notice Converts the specified amount of assets to shares upon an `add` action.
/// @dev Rounds down to the nearest shares amount.
/// @dev Defaults to a 1:1 exchange rate.
/// @param assetId The identifier of the asset.
/// @param assets The amount of assets to convert to shares amount.
/// @return The amount of shares converted from assets amount.
function previewAddByAssets(uint256 assetId, uint256 assets) external view returns (uint256);
/// @notice Converts the specified shares amount to assets amount added upon an `add` action.
/// @dev Rounds up to the nearest assets amount.
/// @dev Defaults to a 1:1 exchange rate.
/// @param assetId The identifier of the asset.
/// @param shares The amount of shares to convert to assets amount.
/// @return The amount of assets converted from shares amount.
function previewAddByShares(uint256 assetId, uint256 shares) external view returns (uint256);
/// @notice Converts the specified amount of assets to shares amount removed upon a `remove` action.
/// @dev Rounds up to the nearest shares amount.
/// @dev Defaults to a 1:1 exchange rate.
/// @param assetId The identifier of the asset.
/// @param assets The amount of assets to convert to shares amount.
/// @return The amount of shares converted from assets amount.
function previewRemoveByAssets(uint256 assetId, uint256 assets) external view returns (uint256);
/// @notice Converts the specified amount of shares to assets amount removed upon a `remove` action.
/// @dev Rounds down to the nearest assets amount.
/// @dev Defaults to a 1:1 exchange rate.
/// @param assetId The identifier of the asset.
/// @param shares The amount of shares to convert to assets amount.
/// @return The amount of assets converted from shares amount.
function previewRemoveByShares(uint256 assetId, uint256 shares) external view returns (uint256);
/// @notice Converts the specified amount of assets to shares amount drawn upon a `draw` action.
/// @dev Rounds up to the nearest shares amount.
/// @param assetId The identifier of the asset.
/// @param assets The amount of assets to convert to shares amount.
/// @return The amount of shares converted from assets amount.
function previewDrawByAssets(uint256 assetId, uint256 assets) external view returns (uint256);
/// @notice Converts the specified amount of shares to assets amount drawn upon a `draw` action.
/// @dev Rounds down to the nearest assets amount.
/// @param assetId The identifier of the asset.
/// @param shares The amount of shares to convert to assets amount.
/// @return The amount of assets converted from shares amount.
function previewDrawByShares(uint256 assetId, uint256 shares) external view returns (uint256);
/// @notice Converts the specified amount of assets to shares amount restored upon a `restore` action.
/// @dev Rounds down to the nearest shares amount.
/// @param assetId The identifier of the asset.
/// @param assets The amount of assets to convert to shares amount.
/// @return The amount of shares converted from assets amount.
function previewRestoreByAssets(uint256 assetId, uint256 assets) external view returns (uint256);
/// @notice Converts the specified amount of shares to assets amount restored upon a `restore` action.
/// @dev Rounds up to the nearest assets amount.
/// @param assetId The identifier of the asset.
/// @param shares The amount of drawn shares to convert to assets amount.
/// @return The amount of assets converted from shares amount.
function previewRestoreByShares(uint256 assetId, uint256 shares) external view returns (uint256);
/// @notice Returns the asset identifier for the specified underlying asset.
/// @dev Reverts with `AssetNotListed` if the underlying is not listed.
/// @param underlying The address of the underlying asset.
function getAssetId(address underlying) external view returns (uint256);
/// @notice Returns the underlying address and decimals of the specified asset.
/// @param assetId The identifier of the asset.
/// @return The underlying address of the asset.
/// @return The decimals of the asset.
function getAssetUnderlyingAndDecimals(uint256 assetId) external view returns (address, uint8);
/// @notice Calculates the current drawn index for the specified asset.
/// @param assetId The identifier of the asset.
/// @return The current drawn index of the asset.
function getAssetDrawnIndex(uint256 assetId) external view returns (uint256);
/// @notice Returns the total amount of the specified asset added to the Hub.
/// @param assetId The identifier of the asset.
/// @return The amount of the asset added.
function getAddedAssets(uint256 assetId) external view returns (uint256);
/// @notice Returns the total amount of shares of the specified asset added to the Hub.
/// @param assetId The identifier of the asset.
/// @return The amount of shares of the asset added.
function getAddedShares(uint256 assetId) external view returns (uint256);
/// @notice Returns the amount of owed drawn and premium assets for the specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of owed drawn assets.
/// @return The amount of owed premium assets.
function getAssetOwed(uint256 assetId) external view returns (uint256, uint256);
/// @notice Returns the total amount of assets owed to the Hub.
/// @param assetId The identifier of the asset.
/// @return The total amount of the assets owed.
function getAssetTotalOwed(uint256 assetId) external view returns (uint256);
/// @notice Returns the amount of owed premium with full precision for specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of premium owed, expressed in asset units and scaled by RAY.
function getAssetPremiumRay(uint256 assetId) external view returns (uint256);
/// @notice Returns the amount of drawn shares of the specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of drawn shares.
function getAssetDrawnShares(uint256 assetId) external view returns (uint256);
/// @notice Returns the information regarding premium shares of the specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of premium shares owed to the asset.
/// @return The premium offset of the asset, expressed in asset units and scaled by RAY.
function getAssetPremiumData(uint256 assetId) external view returns (uint256, int256);
/// @notice Returns the amount of available liquidity for the specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of available liquidity.
function getAssetLiquidity(uint256 assetId) external view returns (uint256);
/// @notice Returns the amount of deficit with full precision of the specified asset.
/// @param assetId The identifier of the asset.
/// @return The amount of deficit, expressed in asset units and scaled by RAY.
function getAssetDeficitRay(uint256 assetId) external view returns (uint256);
/// @notice Returns the total amount of the specified assets added to the Hub by the specified spoke.
/// @dev If spoke is `asset.feeReceiver`, includes converted `unrealizedFeeShares` in return value.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of added assets.
function getSpokeAddedAssets(uint256 assetId, address spoke) external view returns (uint256);
/// @notice Returns the total amount of shares of the specified asset added to the Hub by the specified spoke.
/// @dev If spoke is `asset.feeReceiver`, includes `unrealizedFeeShares` in return value.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of added shares.
function getSpokeAddedShares(uint256 assetId, address spoke) external view returns (uint256);
/// @notice Returns the amount of the specified assets owed to the Hub by the specified spoke.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of owed drawn assets.
/// @return The amount of owed premium assets.
function getSpokeOwed(uint256 assetId, address spoke) external view returns (uint256, uint256);
/// @notice Returns the total amount of the specified asset owed to the Hub by the specified spoke.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The total amount of the asset owed.
function getSpokeTotalOwed(uint256 assetId, address spoke) external view returns (uint256);
/// @notice Returns the amount of owed premium with full precision for specified asset and spoke.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of owed premium assets, expressed in asset units and scaled by RAY.
function getSpokePremiumRay(uint256 assetId, address spoke) external view returns (uint256);
/// @notice Returns the amount of drawn shares of the specified asset by the specified spoke.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of drawn shares.
function getSpokeDrawnShares(uint256 assetId, address spoke) external view returns (uint256);
/// @notice Returns the information regarding premium shares of the specified asset for the specified spoke.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of premium shares.
/// @return The premium offset, expressed in asset units and scaled by RAY.
function getSpokePremiumData(
uint256 assetId,
address spoke
) external view returns (uint256, int256);
/// @notice Returns the amount of a given spoke's deficit with full precision for the specified asset.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @return The amount of deficit, expressed in asset units and scaled by RAY.
function getSpokeDeficitRay(uint256 assetId, address spoke) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/hub/interfaces/IHubConfigurator.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IHub} from 'src/hub/interfaces/IHub.sol';
/// @title IHubConfigurator
/// @author Aave Labs
/// @notice Interface for HubConfigurator.
interface IHubConfigurator {
/// @notice Thrown when an address parameter is the zero address.
error InvalidAddress();
/// @notice Thrown when the list of assets and spoke configs are not the same length in `addSpokeToAssets`.
error MismatchedConfigs();
/// @notice Adds a new asset to a specified Hub.
/// @dev Retrieves the decimals of the underlying asset from its ERC20 contract.
/// @dev The fee receiver is automatically added as a Spoke with maximum caps.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @param feeReceiver The address of the fee receiver Spoke.
/// @param liquidityFee The liquidity fee of the asset, expressed in BPS.
/// @param irStrategy The address of the interest rate strategy contract.
/// @param irData The interest rate data to apply to the given asset, encoded in bytes.
/// @return The unique identifier of the added asset.
function addAsset(
address hub,
address underlying,
address feeReceiver,
uint256 liquidityFee,
address irStrategy,
bytes calldata irData
) external returns (uint256);
/// @notice Adds a new asset to a specified Hub with explicit decimals.
/// @dev The fee receiver is automatically added as a Spoke with maximum caps.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @param decimals The number of decimals of the asset.
/// @param feeReceiver The address of the fee receiver Spoke.
/// @param liquidityFee The liquidity fee of the asset, expressed in BPS.
/// @param irStrategy The address of the interest rate strategy contract.
/// @param irData The interest rate data to apply to the given asset, encoded in bytes.
/// @return The unique identifier of the added asset.
function addAssetWithDecimals(
address hub,
address underlying,
uint8 decimals,
address feeReceiver,
uint256 liquidityFee,
address irStrategy,
bytes calldata irData
) external returns (uint256);
/// @notice Updates the liquidity fee of an asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param liquidityFee The new liquidity fee.
function updateLiquidityFee(address hub, uint256 assetId, uint256 liquidityFee) external;
/// @notice Updates the fee receiver of an asset on a specified hub.
/// @dev The fee receiver cannot be zero.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param feeReceiver The new fee receiver.
function updateFeeReceiver(address hub, uint256 assetId, address feeReceiver) external;
/// @notice Updates the liquidity fee and fee receiver of an asset on a specified Hub.
/// @dev The fee receiver cannot be zero.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param liquidityFee The new liquidity fee.
/// @param feeReceiver The new fee receiver.
function updateFeeConfig(
address hub,
uint256 assetId,
uint256 liquidityFee,
address feeReceiver
) external;
/// @notice Updates the interest rate strategy of an asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param irStrategy The new interest rate strategy.
/// @param irData The interest rate data to apply to the given asset, encoded in bytes.
function updateInterestRateStrategy(
address hub,
uint256 assetId,
address irStrategy,
bytes calldata irData
) external;
/// @notice Updates the reinvestment controller of an asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param reinvestmentController The new reinvestment controller.
function updateReinvestmentController(
address hub,
uint256 assetId,
address reinvestmentController
) external;
/// @notice Resets all Spokes' add and draw caps to zero for an asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
function resetAssetCaps(address hub, uint256 assetId) external;
/// @notice Deactivates an asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
function deactivateAsset(address hub, uint256 assetId) external;
/// @notice Halts an asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
function haltAsset(address hub, uint256 assetId) external;
/// @notice Registers the Spoke for the specified asset on a specified Hub.
/// @param hub The address of the Hub.
/// @param spoke The address of the Spoke.
/// @param assetId The identifier of the asset to register the Spoke for.
/// @param config The Spoke configuration to register.
function addSpoke(
address hub,
address spoke,
uint256 assetId,
IHub.SpokeConfig calldata config
) external;
/// @notice Registers the same Spoke for multiple assets on a specified Hub, each with their own configuration.
/// @dev The i-th asset identifier in `assetIds` corresponds to the i-th configuration in `configs`.
/// @param hub The address of the Hub.
/// @param spoke The address of the Spoke.
/// @param assetIds The list of asset identifiers to register the Spoke for.
/// @param configs The list of Spoke configurations to register.
function addSpokeToAssets(
address hub,
address spoke,
uint256[] calldata assetIds,
IHub.SpokeConfig[] calldata configs
) external;
/// @notice Updates the active flag of an asset's Spoke on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param active The new active flag.
function updateSpokeActive(address hub, uint256 assetId, address spoke, bool active) external;
/// @notice Updates the halted flag of an asset's Spoke on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param halted The new halted flag.
function updateSpokeHalted(address hub, uint256 assetId, address spoke, bool halted) external;
/// @notice Updates the add cap of an asset's spoke on a specified hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param addCap The new add cap.
function updateSpokeAddCap(address hub, uint256 assetId, address spoke, uint256 addCap) external;
/// @notice Updates the draw cap of an asset's Spoke on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param drawCap The new draw cap.
function updateSpokeDrawCap(
address hub,
uint256 assetId,
address spoke,
uint256 drawCap
) external;
/// @notice Updates the risk premium threshold of an asset's Spoke on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param riskPremiumThreshold The new risk premium threshold.
function updateSpokeRiskPremiumThreshold(
address hub,
uint256 assetId,
address spoke,
uint256 riskPremiumThreshold
) external;
/// @notice Updates the caps of an asset's Spoke on a specified Hub.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param spoke The address of the Spoke.
/// @param addCap The new add cap.
/// @param drawCap The new draw cap.
function updateSpokeCaps(
address hub,
uint256 assetId,
address spoke,
uint256 addCap,
uint256 drawCap
) external;
/// @notice Deactivates all assets of a Spoke on a specified Hub by setting the active flag to false.
/// @param hub The address of the Hub.
/// @param spoke The address of the Spoke.
function deactivateSpoke(address hub, address spoke) external;
/// @notice Halts all assets of a Spoke on a specified Hub by setting the halted flag to true.
/// @param hub The address of the Hub.
/// @param spoke The address of the Spoke.
function haltSpoke(address hub, address spoke) external;
/// @notice Resets draw cap and add cap to zero for a Spoke on a specified Hub.
/// @param hub The address of the Hub.
/// @param spoke The address of the Spoke.
function resetSpokeCaps(address hub, address spoke) external;
/// @notice Updates the interest rate data for an asset.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
/// @param irData The interest rate data to apply to the given asset, encoded in bytes.
function updateInterestRateData(address hub, uint256 assetId, bytes calldata irData) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IExtSload.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title IExtSload
/// @author Aave Labs
/// @notice Minimal interface to easily access storage of source contract externally. See https://eips.ethereum.org/EIPS/eip-2330#rationale.
interface IExtSload {
/// @notice Returns the storage `value` of this contract at a given `slot`.
/// @param slot Slot to SLOAD from.
function extSload(bytes32 slot) external view returns (bytes32 value);
/// @notice Returns the storage `values` of this contract at the given `slots`.
/// @param slots Array of slots to SLOAD from.
function extSloads(bytes32[] calldata slots) external view returns (bytes32[] memory values);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IIntentConsumer.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {INoncesKeyed} from 'src/interfaces/INoncesKeyed.sol';
/// @title IIntentConsumer
/// @author Aave Labs
/// @notice Minimal interface for IntentConsumer.
interface IIntentConsumer is INoncesKeyed {
/// @notice Thrown when given signature is invalid.
error InvalidSignature();
/// @notice Returns the EIP-712 domain separator.
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IMulticall.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title IMulticall
/// @author Aave Labs
/// @notice Minimal interface for Multicall.
interface IMulticall {
/// @notice Call multiple functions in the current contract and return the data from each if they all succeed.
/// @param data The encoded function data for each of the calls to make to this contract.
/// @return results The results from each of the calls passed in via data.
function multicall(bytes[] calldata data) external returns (bytes[] memory);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/INoncesKeyed.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
interface INoncesKeyed {
/// @notice Thrown when nonce being consumed does not match `currentNonce` for `account`.
error InvalidAccountNonce(address account, uint256 currentNonce);
/// @notice Allows caller to revoke their next sequential nonce at specified `key`.
/// @dev This does not invalidate nonce at other `key`s namespace.
/// @param key The key which specifies namespace of the nonce.
/// @return keyNonce The revoked key-prefixed nonce.
function useNonce(uint192 key) external returns (uint256 keyNonce);
/// @notice Returns the next unused nonce for an address and key. Result contains the key prefix.
/// @param owner The address of the nonce owner.
/// @param key The key which specifies namespace of the nonce.
/// @return keyNonce The first 24 bytes are for the key, & the last 8 bytes for the nonce.
function nonces(address owner, uint192 key) external view returns (uint256 keyNonce);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/interfaces/IRescuable.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title IRescuable
/// @author Aave Labs
/// @notice Interface for Rescuable.
interface IRescuable {
/// @notice Thrown when caller is not the rescue guardian.
error OnlyRescueGuardian();
/// @notice Recovers ERC20 tokens sent to this contract.
/// @param token The address of the ERC20 token to rescue.
/// @param to The address to send the rescued tokens to.
/// @param amount Amount of tokens to rescue.
function rescueToken(address token, address to, uint256 amount) external;
/// @notice Recovers native assets remaining in this contract.
/// @param to The address to send rescued native assets to.
/// @param amount Amount of native assets to rescue.
function rescueNative(address to, uint256 amount) external;
/// @notice Returns the rescue guardian address.
/// @return The address allowed to rescue funds.
function rescueGuardian() external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IConfigPositionManager.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IPositionManagerIntentBase} from 'src/position-manager/interfaces/IPositionManagerIntentBase.sol';
type ConfigPermissions is uint8;
/// @title IConfigPositionManager
/// @author Aave Labs
/// @notice Interface for position manager handling user configuration actions on behalf of an user.
interface IConfigPositionManager is IPositionManagerIntentBase {
/// @notice Struct to hold the config permission values.
/// @dev canSetUsingAsCollateral Whether the delegatee can set using as collateral on behalf of the user.
/// @dev canUpdateUserRiskPremium Whether the delegatee can update user risk premium on behalf of the user.
/// @dev canUpdateUserDynamicConfig Whether the delegatee can update user dynamic config on behalf of the user.
struct ConfigPermissionValues {
bool canSetUsingAsCollateral;
bool canUpdateUserRiskPremium;
bool canUpdateUserDynamicConfig;
}
/// @notice Structured parameters for global permission permit intent.
/// @dev spoke The address of the Spoke.
/// @dev delegator The address of the delegator.
/// @dev delegatee The address of the delegatee.
/// @dev status The new status of the permission.
/// @dev nonce The key-prefixed nonce for the signature.
/// @dev deadline The deadline for the intent.
struct SetGlobalPermissionPermit {
address spoke;
address delegator;
address delegatee;
bool status;
uint256 nonce;
uint256 deadline;
}
/// @notice Structured parameters for using as collateral permission permit intent.
/// @dev spoke The address of the Spoke.
/// @dev delegator The address of the delegator.
/// @dev delegatee The address of the delegatee.
/// @dev status The new status of the permission.
/// @dev nonce The key-prefixed nonce for the signature.
/// @dev deadline The deadline for the intent.
struct SetCanSetUsingAsCollateralPermissionPermit {
address spoke;
address delegator;
address delegatee;
bool status;
uint256 nonce;
uint256 deadline;
}
/// @notice Structured parameters for user risk premium permission permit intent.
/// @dev spoke The address of the Spoke.
/// @dev delegator The address of the delegator.
/// @dev delegatee The address of the delegatee.
/// @dev status The new status of the permission.
/// @dev nonce The key-prefixed nonce for the signature.
/// @dev deadline The deadline for the intent.
struct SetCanUpdateUserRiskPremiumPermissionPermit {
address spoke;
address delegator;
address delegatee;
bool status;
uint256 nonce;
uint256 deadline;
}
/// @notice Structured parameters for user dynamic config permission permit intent.
/// @dev spoke The address of the Spoke.
/// @dev delegator The address of the delegator.
/// @dev delegatee The address of the delegatee.
/// @dev status The new status of the permission.
/// @dev nonce The key-prefixed nonce for the signature.
/// @dev deadline The deadline for the intent.
struct SetCanUpdateUserDynamicConfigPermissionPermit {
address spoke;
address delegator;
address delegatee;
bool status;
uint256 nonce;
uint256 deadline;
}
/// @notice Emitted when a global config permission is updated.
/// @param spoke The address of the Spoke.
/// @param delegator The address of the delegator.
/// @param delegatee The address of the delegatee.
/// @param oldPermissions The old config permissions.
/// @param newPermissions The new config permissions.
event UpdateConfigPermissions(
address indexed spoke,
address indexed delegator,
address indexed delegatee,
ConfigPermissions oldPermissions,
ConfigPermissions newPermissions
);
/// @notice Emitted when setting using as collateral on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator.
/// @param onBehalfOf The owner of the position being modified.
/// @param reserveId The identifier of the reserve.
/// @param usingAsCollateral Whether the reserve is enabled or disabled as collateral.
event SetUsingAsCollateralOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf,
uint256 reserveId,
bool usingAsCollateral
);
/// @notice Emitted when updating user risk premium on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator.
/// @param onBehalfOf The owner of the position being modified.
event UpdateUserRiskPremiumOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf
);
/// @notice Emitted when updating dynamic config on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator.
/// @param onBehalfOf The owner of the position being modified.
event UpdateUserDynamicConfigOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf
);
/// @notice Thrown when the delegatee of a function was not given permission by the user.
error DelegateeNotAllowed();
/// @notice Sets the global permission for a delegatee.
/// @param spoke The address of the Spoke.
/// @param delegatee The address of the delegatee.
/// @param status The new permission status.
function setGlobalPermission(address spoke, address delegatee, bool status) external;
/// @notice Sets the using as collateral permission for a delegatee.
/// @param spoke The address of the Spoke.
/// @param delegatee The address of the delegatee.
/// @param status The new permission status.
function setCanSetUsingAsCollateralPermission(
address spoke,
address delegatee,
bool status
) external;
/// @notice Sets the user risk premium permission for a delegatee.
/// @param spoke The address of the Spoke.
/// @param delegatee The address of the delegatee.
/// @param status The new permission status.
function setCanUpdateUserRiskPremiumPermission(
address spoke,
address delegatee,
bool status
) external;
/// @notice Sets the user dynamic config permission for a delegatee.
/// @param spoke The address of the Spoke.
/// @param delegatee The address of the delegatee.
/// @param status The new permission status.
function setCanUpdateUserDynamicConfigPermission(
address spoke,
address delegatee,
bool status
) external;
/// @notice Sets the global permission for a delegatee using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The structured SetGlobalPermissionPermit parameters.
/// @param signature The EIP712-compliant signature bytes.
function setGlobalPermissionWithSig(
SetGlobalPermissionPermit calldata params,
bytes calldata signature
) external;
/// @notice Sets the using as collateral permission for a delegatee using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The structured SetCanSetUsingAsCollateralPermissionPermit parameters.
/// @param signature The EIP712-compliant signature bytes.
function setCanSetUsingAsCollateralPermissionWithSig(
SetCanSetUsingAsCollateralPermissionPermit calldata params,
bytes calldata signature
) external;
/// @notice Sets the user risk premium permission for a delegatee using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The structured SetCanUpdateUserRiskPremiumPermissionPermit parameters.
/// @param signature The EIP712-compliant signature bytes.
function setCanUpdateUserRiskPremiumPermissionWithSig(
SetCanUpdateUserRiskPremiumPermissionPermit calldata params,
bytes calldata signature
) external;
/// @notice Sets the user dynamic config permission for a delegatee using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The structured SetCanUpdateUserDynamicConfigPermissionPermit parameters.
/// @param signature The EIP712-compliant signature bytes.
function setCanUpdateUserDynamicConfigPermissionWithSig(
SetCanUpdateUserDynamicConfigPermissionPermit calldata params,
bytes calldata signature
) external;
/// @notice Renounces the global permission given by the delegator.
/// @param spoke The address of the Spoke.
/// @param delegator The address of the delegator.
function renounceGlobalPermission(address spoke, address delegator) external;
/// @notice Renounces the using as collateral permission given by the delegator.
/// @param spoke The address of the Spoke.
/// @param delegator The address of the delegator.
function renounceCanUpdateUsingAsCollateralPermission(address spoke, address delegator) external;
/// @notice Renounces the user risk premium permission given by the delegator.
/// @param spoke The address of the Spoke.
/// @param delegator The address of the delegator.
function renounceCanUpdateUserRiskPremiumPermission(address spoke, address delegator) external;
/// @notice Renounces the user dynamic config permission given by the delegator.
/// @param spoke The address of the Spoke.
/// @param delegator The address of the delegator.
function renounceCanUpdateUserDynamicConfigPermission(address spoke, address delegator) external;
/// @notice Sets the using as collateral status on behalf of a user for a specified reserve.
/// @dev The `msg.sender` must be the delegatee to perform this action on behalf of the user.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param reserveId The id of the reserve.
/// @param usingAsCollateral The new using as collateral status.
/// @param onBehalfOf The address of the user.
function setUsingAsCollateralOnBehalfOf(
address spoke,
uint256 reserveId,
bool usingAsCollateral,
address onBehalfOf
) external;
/// @notice Updates the user risk premium on behalf of a user.
/// @dev The `msg.sender` must be the delegatee to perform this action on behalf of the user.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param onBehalfOf The address of the user.
function updateUserRiskPremiumOnBehalfOf(address spoke, address onBehalfOf) external;
/// @notice Updates the user dynamic config on behalf of a user.
/// @dev The `msg.sender` must be the delegatee to perform this action on behalf of the user.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param onBehalfOf The address of the user.
function updateUserDynamicConfigOnBehalfOf(address spoke, address onBehalfOf) external;
/// @notice Returns the config permissions for a delegatee on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param delegatee The address of the delegatee.
/// @param onBehalfOf The address of the user.
/// @return The ConfigPermissionValues for the delegatee on behalf of the user.
function getConfigPermissions(
address spoke,
address delegatee,
address onBehalfOf
) external view returns (ConfigPermissionValues memory);
/// @notice Returns the type hash for the SetGlobalPermissionPermit intent.
function SET_GLOBAL_PERMISSION_PERMIT_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the SetCanSetUsingAsCollateralPermissionPermit intent.
function SET_CAN_SET_USING_AS_COLLATERAL_PERMISSION_PERMIT_TYPEHASH()
external
view
returns (bytes32);
/// @notice Returns the type hash for the SetCanUpdateUserRiskPremiumPermissionPermit intent.
function SET_CAN_UPDATE_USER_RISK_PREMIUM_PERMISSION_PERMIT_TYPEHASH()
external
view
returns (bytes32);
/// @notice Returns the type hash for the SetCanUpdateUserDynamicConfigPermissionPermit intent.
function SET_CAN_UPDATE_USER_DYNAMIC_CONFIG_PERMISSION_PERMIT_TYPEHASH()
external
view
returns (bytes32);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IGiverPositionManager.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IPositionManagerBase} from 'src/position-manager/interfaces/IPositionManagerBase.sol';
/// @title IGiverPositionManager
/// @author Aave Labs
/// @notice Interface for position manager handling supply and repay actions on behalf of users.
interface IGiverPositionManager is IPositionManagerBase {
/// @notice Emitted when supplying on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator, and supplier of the underlying asset.
/// @param onBehalfOf The owner of the modified position.
/// @param reserveId The identifier of the reserve.
/// @param suppliedShares The amount of supply shares minted.
/// @param suppliedAmount The amount of underlying asset supplied.
event SupplyOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf,
uint256 reserveId,
uint256 suppliedShares,
uint256 suppliedAmount
);
/// @notice Emitted when repaying on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator who is repaying the underlying asset.
/// @param onBehalfOf The owner of the position whose debt is being repaid.
/// @param reserveId The identifier of the reserve.
/// @param repaidShares The amount of debt shares burned.
/// @param repaidAmount The amount of underlying asset repaid.
event RepayOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf,
uint256 reserveId,
uint256 repaidShares,
uint256 repaidAmount
);
/// @notice Error thrown when the repay amount is set to `type(uint256).max`, as it is not allowed.
error RepayOnBehalfMaxUintNotAllowed();
/// @notice Executes a supply on behalf of a user.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount to supply.
/// @param onBehalfOf The address of the user to supply on behalf of.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supplyOnBehalfOf(
address spoke,
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Executes a repay on behalf of a user.
/// @dev If the amount exceeds the user's current debt, the entire debt is repaid.
/// @dev Using `type(uint256).max` to repay the full debt is not allowed with this method.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount to repay.
/// @param onBehalfOf The address of the user to repay on behalf of.
/// @return The amount of shares repaid.
/// @return The amount of assets repaid.
function repayOnBehalfOf(
address spoke,
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/INativeTokenGateway.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IPositionManagerBase} from 'src/position-manager/interfaces/IPositionManagerBase.sol';
/// @title INativeTokenGateway
/// @author Aave Labs
/// @notice Abstracts actions to the protocol involving the native token.
/// @dev Must be set as `PositionManager` on the Spoke for the user.
interface INativeTokenGateway is IPositionManagerBase {
/// @notice Thrown when the underlying asset is not the wrapped native asset.
error NotNativeWrappedAsset();
/// @notice Thrown when the native amount sent does not match the given amount parameter.
error NativeAmountMismatch();
/// @notice Wraps the native asset and supplies to a specified registered Spoke.
/// @dev Contract must be an active and approved user position manager of the caller.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve for the wrapped asset.
/// @param amount Amount to wrap and supply.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supplyNative(
address spoke,
uint256 reserveId,
uint256 amount
) external payable returns (uint256, uint256);
/// @notice Wraps the native asset, supplies to a specified registered Spoke and sets it as collateral.
/// @dev Contract must be an active and approved user position manager of the caller.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve for the wrapped asset.
/// @param amount Amount to wrap and supply.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supplyAsCollateralNative(
address spoke,
uint256 reserveId,
uint256 amount
) external payable returns (uint256, uint256);
/// @notice Withdraws the wrapped asset from a specified registered Spoke and unwraps it back to the native asset.
/// @dev Contract must be an active and approved user position manager of the caller.
/// @dev The withdrawn amount may be lower than requested if the user has insufficient supplied assets.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve for the wrapped asset.
/// @param amount Amount to withdraw and unwrap.
/// @return The amount of shares withdrawn.
/// @return The amount of assets withdrawn.
function withdrawNative(
address spoke,
uint256 reserveId,
uint256 amount
) external returns (uint256, uint256);
/// @notice Borrows the wrapped asset from a specified registered Spoke and unwraps it back to the native asset.
/// @dev Contract must be an active and approved user position manager of the caller.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve for the wrapped asset.
/// @param amount Amount to borrow and unwrap.
/// @return The amount of shares borrowed.
/// @return The amount of assets borrowed.
function borrowNative(
address spoke,
uint256 reserveId,
uint256 amount
) external returns (uint256, uint256);
/// @notice Wraps the native asset and repays debt on a specified registered Spoke.
/// @dev It refunds any excess funds sent beyond the required debt repayment.
/// @dev Contract must be an active and approved user position manager of the caller.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve for the wrapped asset.
/// @param amount Amount to wrap and repay.
/// @return The amount of shares repaid.
/// @return The amount of assets repaid.
function repayNative(
address spoke,
uint256 reserveId,
uint256 amount
) external payable returns (uint256, uint256);
/// @notice Returns the address of the Native Wrapper.
function NATIVE_TOKEN_WRAPPER() external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IPositionManagerBase.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IMulticall} from 'src/interfaces/IMulticall.sol';
import {IRescuable} from 'src/interfaces/IRescuable.sol';
/// @title IPositionManagerBase
/// @author Aave Labs
/// @notice Base interface for position managers.
/// @dev This base interface is not mandatory for position managers, it only provides optional convenience methods.
interface IPositionManagerBase is IRescuable, IMulticall {
/// @notice Emitted when the Spoke's registration status is updated.
event RegisterSpoke(address indexed spoke, bool registered);
/// @notice Thrown when the specified address is invalid.
error InvalidAddress();
/// @notice Thrown when the specified amount is invalid.
error InvalidAmount();
/// @notice Thrown when trying to call an unsupported action on this position manager.
error UnsupportedAction();
/// @notice Thrown when the specified Spoke is not registered.
error SpokeNotRegistered();
/// @notice Facilitates setting this position manager as user position manager on the specified registered Spoke
/// with a typed signature from `onBehalfOf`.
/// @dev The signature is consumed on the specified registered Spoke.
/// @dev The given data is passed to the Spoke for the signature to be verified.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param spoke The address of the registered spoke.
/// @param onBehalfOf The address of the user on whose behalf this position manager can act.
/// @param approve True to approve the position manager, false to revoke approval.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
/// @param signature The EIP712-typed signed bytes for the intent.
function setSelfAsUserPositionManagerWithSig(
address spoke,
address onBehalfOf,
bool approve,
uint256 nonce,
uint256 deadline,
bytes calldata signature
) external;
/// @notice Facilitates consuming a permit for the given reserve's underlying asset on the specified registered Spoke.
/// @dev The given data is passed to the underlying asset for the signature to be verified.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Spender is this position manager contract.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param onBehalfOf The address of the user on whose behalf the permit is being used.
/// @param value The amount of the underlying asset to permit.
/// @param deadline The deadline for the permit.
function permitReserveUnderlying(
address spoke,
uint256 reserveId,
address onBehalfOf,
uint256 value,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external;
/// @notice Allows contract to renounce its position manager role for the specified user.
/// @param spoke The address of the registered Spoke.
/// @param user The address of the user to renounce the position manager role for.
function renouncePositionManagerRole(address spoke, address user) external;
/// @notice Registers or deregisters the Spoke.
/// @param spoke The address of the Spoke.
/// @param registered `true` to register, `false` to deregister.
function registerSpoke(address spoke, bool registered) external;
/// @notice Returns whether the specified Spoke is registered.
/// @param spoke The address of the Spoke.
/// @return `true` if the Spoke is registered, `false` otherwise.
function isSpokeRegistered(address spoke) external view returns (bool);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/IPositionManagerIntentBase.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IIntentConsumer} from 'src/interfaces/IIntentConsumer.sol';
import {IPositionManagerBase} from 'src/position-manager/interfaces/IPositionManagerBase.sol';
/// @title IPositionManagerIntentBase
/// @author Aave Labs
/// @notice Interface to extend PositionManagerBase with intent consuming capabilities.
interface IPositionManagerIntentBase is IIntentConsumer, IPositionManagerBase {}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/ISignatureGateway.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IPositionManagerIntentBase} from 'src/position-manager/interfaces/IPositionManagerIntentBase.sol';
/// @title ISignatureGateway
/// @author Aave Labs
/// @notice Minimal interface for protocol actions involving signed intents.
interface ISignatureGateway is IPositionManagerIntentBase {
/// @notice Intent data to supply assets to a reserve.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of assets to supply.
/// @param onBehalfOf The address of the user on whose behalf the supply is performed.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct Supply {
address spoke;
uint256 reserveId;
uint256 amount;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to withdraw assets from a reserve.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of assets to withdraw.
/// @param onBehalfOf The address of the user on whose behalf the withdraw is performed.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct Withdraw {
address spoke;
uint256 reserveId;
uint256 amount;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to borrow assets from a reserve.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of assets to borrow.
/// @param onBehalfOf The address of the user on whose behalf the borrow is performed.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct Borrow {
address spoke;
uint256 reserveId;
uint256 amount;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to repay assets to a reserve.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of assets to repay.
/// @param onBehalfOf The address of the user on whose behalf the repay is performed.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct Repay {
address spoke;
uint256 reserveId;
uint256 amount;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to enable or disable a reserve as collateral.
/// @param spoke The address of the registered Spoke.
/// @param reserveId The identifier of the reserve.
/// @param useAsCollateral True to enable the reserve as collateral, false to disable it.
/// @param onBehalfOf The address of the user on whose behalf the action is performed.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct SetUsingAsCollateral {
address spoke;
uint256 reserveId;
bool useAsCollateral;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to update the risk premium of a user position.
/// @param spoke The address of the registered Spoke.
/// @param onBehalfOf The address of the user whose risk premium is being updated.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct UpdateUserRiskPremium {
address spoke;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to update the dynamic configuration of a user position.
/// @param spoke The address of the registered Spoke.
/// @param onBehalfOf The address of the user whose dynamic config is being updated.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct UpdateUserDynamicConfig {
address spoke;
address onBehalfOf;
uint256 nonce;
uint256 deadline;
}
/// @notice Facilitates `supply` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Supplied assets are pulled from `onBehalfOf`, prior approval to this gateway is required.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured supply parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supplyWithSig(
Supply calldata params,
bytes calldata signature
) external returns (uint256, uint256);
/// @notice Facilitates `withdraw` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Providing an amount exceeding the user's current withdrawable balance indicates a request for a maximum withdrawal.
/// @dev Withdrawn assets are pushed to `onBehalfOf`.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured withdraw parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
/// @return The amount of shares withdrawn.
/// @return The amount of assets withdrawn.
function withdrawWithSig(
Withdraw calldata params,
bytes calldata signature
) external returns (uint256, uint256);
/// @notice Facilitates `borrow` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Borrowed assets are pushed to `onBehalfOf`.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured borrow parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
/// @return The amount of shares borrowed.
/// @return The amount of assets borrowed.
function borrowWithSig(
Borrow calldata params,
bytes calldata signature
) external returns (uint256, uint256);
/// @notice Facilitates `repay` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Repay assets are pulled from `onBehalfOf`, prior approval to this gateway is required.
/// @dev Providing an amount greater than the user's current debt indicates a request to repay the maximum possible amount.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured repay parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
/// @return The amount of shares repaid.
/// @return The amount of assets repaid.
function repayWithSig(
Repay calldata params,
bytes calldata signature
) external returns (uint256, uint256);
/// @notice Facilitates `setUsingAsCollateral` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured setUsingAsCollateral parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
function setUsingAsCollateralWithSig(
SetUsingAsCollateral calldata params,
bytes calldata signature
) external;
/// @notice Facilitates `updateUserRiskPremium` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured updateUserRiskPremium parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
function updateUserRiskPremiumWithSig(
UpdateUserRiskPremium calldata params,
bytes calldata signature
) external;
/// @notice Facilitates `updateUserDynamicConfig` action on the specified registered Spoke with a typed signature from `onBehalfOf`.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param params The structured updateUserDynamicConfig parameters.
/// @param signature The EIP712-typed signed bytes for the intent.
function updateUserDynamicConfigWithSig(
UpdateUserDynamicConfig calldata params,
bytes calldata signature
) external;
/// @notice Returns the type hash for the Supply intent.
function SUPPLY_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the Withdraw intent.
function WITHDRAW_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the Borrow intent.
function BORROW_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the Repay intent.
function REPAY_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the SetUsingAsCollateral intent.
function SET_USING_AS_COLLATERAL_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the UpdateUserRiskPremium intent.
function UPDATE_USER_RISK_PREMIUM_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the UpdateUserDynamicConfig intent.
function UPDATE_USER_DYNAMIC_CONFIG_TYPEHASH() external view returns (bytes32);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/position-manager/interfaces/ITakerPositionManager.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IPositionManagerIntentBase} from 'src/position-manager/interfaces/IPositionManagerIntentBase.sol';
/// @title ITakerPositionManager
/// @author Aave Labs
/// @notice Interface for position manager handling withdraw permit and borrow permit actions on behalf of users.
/// @dev Allowances in the context of this TakerPositionManager represent how much the spender is allowed to impact
/// the owner position (decreasing supplied amount for the withdraw action, increasing debt amount for the borrow action),
/// and not the amount of assets that the spender will receive from the onBehalfOf action.
interface ITakerPositionManager is IPositionManagerIntentBase {
/// @notice Structured parameters for withdraw permit intent.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param amount The amount of allowance.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct WithdrawPermit {
address spoke;
uint256 reserveId;
address owner;
address spender;
uint256 amount;
uint256 nonce;
uint256 deadline;
}
/// @notice Structured parameters for borrow permit intent.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param amount The amount of allowance.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct BorrowPermit {
address spoke;
uint256 reserveId;
address owner;
address spender;
uint256 amount;
uint256 nonce;
uint256 deadline;
}
/// @notice Emitted when the withdraw allowance granted to a spender is updated.
/// @param spoke The address of the Spoke.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of allowance.
event WithdrawApproval(
address indexed spoke,
address indexed owner,
address indexed spender,
uint256 reserveId,
uint256 amount
);
/// @notice Emitted when the borrow allowance granted to a spender is updated.
/// @param spoke The address of the Spoke.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of allowance.
event BorrowApproval(
address indexed spoke,
address indexed owner,
address indexed spender,
uint256 reserveId,
uint256 amount
);
/// @notice Emitted when withdrawing on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator, and recipient of the underlying asset being withdrawn.
/// @param onBehalfOf The owner of the modified position.
/// @param reserveId The identifier of the reserve.
/// @param withdrawnShares The amount of supply shares burned.
/// @param withdrawnAmount The amount of underlying asset withdrawn.
event WithdrawOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf,
uint256 reserveId,
uint256 withdrawnShares,
uint256 withdrawnAmount
);
/// @notice Emitted when borrowing on behalf of a user.
/// @param spoke The address of the Spoke.
/// @param caller The transaction initiator, and recipient of the underlying asset being borrowed.
/// @param onBehalfOf The owner of the position on which debt is generated.
/// @param reserveId The identifier of the reserve.
/// @param drawnShares The amount of debt shares minted.
/// @param drawnAmount The amount of underlying asset borrowed.
event BorrowOnBehalfOf(
address indexed spoke,
address indexed caller,
address indexed onBehalfOf,
uint256 reserveId,
uint256 drawnShares,
uint256 drawnAmount
);
/// @notice Thrown when the withdraw allowance is insufficient.
error InsufficientWithdrawAllowance(uint256 allowance, uint256 required);
/// @notice Thrown when the borrow allowance is insufficient.
error InsufficientBorrowAllowance(uint256 allowance, uint256 required);
/// @notice Approves a spender to withdraw assets from the specified reserve on behalf of the owner.
/// @dev Using `type(uint256).max` as the amount results in an infinite approval, so the allowance is never decreased.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param spender The address of the spender to receive the allowance.
/// @param amount The amount of allowance.
function approveWithdraw(
address spoke,
uint256 reserveId,
address spender,
uint256 amount
) external;
/// @notice Approves a spender to withdraw assets from the specified reserve on behalf of the owner using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Using `type(uint256).max` as the amount results in an infinite approval, so the allowance is never decreased.
/// @param params The structured WithdrawPermit parameters.
/// @param signature The EIP712-compliant signature bytes.
function approveWithdrawWithSig(
WithdrawPermit calldata params,
bytes calldata signature
) external;
/// @notice Approves a spender to borrow assets from the specified reserve on behalf of the owner.
/// @dev Using `type(uint256).max` as the amount results in an infinite approval, so the allowance is never decreased.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param spender The address of the spender to receive the allowance.
/// @param amount The amount of allowance.
function approveBorrow(
address spoke,
uint256 reserveId,
address spender,
uint256 amount
) external;
/// @notice Approves a spender to borrow assets from the specified reserve on behalf of the owner using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Using `type(uint256).max` as the amount results in an infinite approval, so the allowance is never decreased.
/// @param params The structured BorrowPermit parameters.
/// @param signature The EIP712-compliant signature bytes.
function approveBorrowWithSig(BorrowPermit calldata params, bytes calldata signature) external;
/// @notice Renounces the withdraw allowance given by the owner.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param owner The address of the owner.
function renounceWithdrawAllowance(address spoke, uint256 reserveId, address owner) external;
/// @notice Renounces the borrow allowance given by the owner.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param owner The address of the owner.
function renounceBorrowAllowance(address spoke, uint256 reserveId, address owner) external;
/// @notice Executes a withdraw on behalf of a user.
/// @dev The caller must have sufficient withdraw allowance from `onBehalfOf`.
/// @dev The caller receives the withdrawn assets.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount to withdraw.
/// @param onBehalfOf The address of the user to withdraw on behalf of.
/// @return The amount of shares withdrawn.
/// @return The amount of assets withdrawn.
function withdrawOnBehalfOf(
address spoke,
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Executes a borrow on behalf of a user.
/// @dev The caller must have sufficient borrow allowance from `onBehalfOf`.
/// @dev The caller receives the borrowed assets.
/// @dev Contract must be an active and approved user position manager of `onBehalfOf`.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount to borrow.
/// @param onBehalfOf The address of the user to borrow on behalf of.
/// @return The amount of shares borrowed.
/// @return The amount of assets borrowed.
function borrowOnBehalfOf(
address spoke,
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Returns the withdraw allowance for a spender on behalf of an owner.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @return The amount of withdraw allowance.
function withdrawAllowance(
address spoke,
uint256 reserveId,
address owner,
address spender
) external view returns (uint256);
/// @notice Returns the borrow allowance for a spender on behalf of an owner.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param owner The address of the owner.
/// @param spender The address of the spender.
/// @return The amount of borrow allowance.
function borrowAllowance(
address spoke,
uint256 reserveId,
address owner,
address spender
) external view returns (uint256);
/// @notice Returns the type hash for the WithdrawPermit intent.
function WITHDRAW_PERMIT_TYPEHASH() external view returns (bytes32);
/// @notice Returns the type hash for the BorrowPermit intent.
function BORROW_PERMIT_TYPEHASH() external view returns (bytes32);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/IAaveOracle.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IPriceOracle} from 'src/spoke/interfaces/IPriceOracle.sol';
/// @title IAaveOracle
/// @author Aave Labs
/// @notice Interface for the Aave Oracle.
interface IAaveOracle is IPriceOracle {
/// @dev Emitted when the price feed source of a reserve is updated.
/// @param reserveId The identifier of the reserve.
/// @param source The price feed source of the reserve.
event UpdateReserveSource(uint256 indexed reserveId, address indexed source);
/// @dev Emitted when the Spoke is set.
/// @param spoke The address of the Spoke.
event SetSpoke(address indexed spoke);
/// @dev Thrown when the caller is not the deployer.
error OnlyDeployer();
/// @dev Thrown when the Spoke is already set.
error SpokeAlreadySet();
/// @dev Thrown when the price feed source uses a different number of decimals than the oracle.
/// @param reserveId The identifier of the reserve.
error InvalidSourceDecimals(uint256 reserveId);
/// @dev Thrown when the price feed source is invalid (zero address).
/// @param reserveId The identifier of the reserve.
error InvalidSource(uint256 reserveId);
/// @dev Thrown when the price feed source returns an invalid price (non-positive).
/// @param reserveId The identifier of the reserve.
error InvalidPrice(uint256 reserveId);
/// @dev Thrown when the given address is invalid.
error InvalidAddress();
/// @dev Thrown when the Spoke's oracle does not match the current oracle.
error OracleMismatch();
/// @notice Sets the address of the Spoke.
/// @dev Can only be called once by the deployer.
/// @dev The spoke should be set before any other function is called.
/// @param spoke The address of the Spoke.
function setSpoke(address spoke) external;
/// @notice Sets the price feed source of a reserve.
/// @dev Must be called by the Spoke.
/// @dev The source must implement IPriceFeed.
/// @param reserveId The identifier of the reserve.
/// @param source The price feed source of the reserve.
function setReserveSource(uint256 reserveId, address source) external;
/// @notice Returns the prices of multiple reserves.
/// @dev Reverts if the price of one of the reserves is not greater than 0.
/// @param reserveIds The identifiers of the reserves.
/// @return prices The prices of the reserves.
function getReservesPrices(
uint256[] calldata reserveIds
) external view returns (uint256[] memory);
/// @notice Returns the price feed source of a reserve.
/// @param reserveId The identifier of the reserve.
/// @return source The price feed source of the reserve.
function getReserveSource(uint256 reserveId) external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/IPriceOracle.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title IPriceOracle
/// @author Aave Labs
/// @notice Basic interface for any price oracle.
/// @dev All prices must use the same number of decimals as the oracle and should be returned in the same currency.
interface IPriceOracle {
/// @dev Reverts if the caller is not the Spoke.
error OnlySpoke();
/// @notice Returns the address of the Spoke.
function spoke() external view returns (address);
/// @notice Returns the number of decimals used to return prices.
function decimals() external view returns (uint8);
/// @notice Returns the reserve price with `decimals` precision.
/// @dev Reverts if the price is not greater than 0.
/// @param reserveId The identifier of the reserve.
/// @return The price of the reserve.
function getReservePrice(uint256 reserveId) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ISpoke.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IAccessManaged} from 'src/dependencies/openzeppelin/IAccessManaged.sol';
import {IIntentConsumer} from 'src/interfaces/IIntentConsumer.sol';
import {IMulticall} from 'src/interfaces/IMulticall.sol';
import {IHubBase} from 'src/hub/interfaces/IHubBase.sol';
import {IExtSload} from 'src/interfaces/IExtSload.sol';
type ReserveFlags is uint8;
/// @title ISpoke
/// @author Aave Labs
/// @notice Full interface for Spoke.
interface ISpoke is IAccessManaged, IIntentConsumer, IExtSload, IMulticall {
/// @notice Intent data to set user position managers with EIP712-typed signature.
/// @param onBehalfOf The address of the user on whose behalf position manager can act.
/// @param updates The array of position manager updates.
/// @param nonce The nonce for the signature.
/// @param deadline The deadline for the signature.
struct SetUserPositionManagers {
address onBehalfOf;
PositionManagerUpdate[] updates;
uint256 nonce;
uint256 deadline;
}
/// @notice Sub-Intent data to apply position manager update for user.
/// @param positionManager The address of the position manager.
/// @param approve True to approve the position manager, false to revoke approval.
struct PositionManagerUpdate {
address positionManager;
bool approve;
}
/// @notice Reserve level data.
/// @dev underlying The address of the underlying asset.
/// @dev hub The address of the associated Hub.
/// @dev assetId The identifier of the asset in the Hub.
/// @dev decimals The number of decimals of the underlying asset.
/// @dev collateralRisk The risk associated with a collateral asset, expressed in BPS.
/// @dev flags The packed boolean flags of the reserve (a wrapped uint8).
/// @dev dynamicConfigKey The key of the last reserve dynamic config.
struct Reserve {
address underlying;
//
IHubBase hub;
uint16 assetId;
uint8 decimals;
uint24 collateralRisk;
ReserveFlags flags;
uint32 dynamicConfigKey;
}
/// @notice Reserve configuration. Subset of the `Reserve` struct.
/// @dev collateralRisk The risk associated with a collateral asset, expressed in BPS.
/// @dev paused True if all actions are prevented for the reserve.
/// @dev frozen True if new activity is prevented for the reserve.
/// @dev borrowable True if the reserve is borrowable.
/// @dev receiveSharesEnabled True if the liquidator can receive collateral shares during liquidation.
struct ReserveConfig {
uint24 collateralRisk;
bool paused;
bool frozen;
bool borrowable;
bool receiveSharesEnabled;
}
/// @notice Dynamic reserve configuration data.
/// @dev collateralFactor The proportion of a reserve's value eligible to be used as collateral, expressed in BPS.
/// @dev maxLiquidationBonus The maximum extra amount of collateral given to the liquidator as bonus, expressed in BPS. 100_00 represents 0.00% bonus.
/// @dev liquidationFee The protocol fee charged on liquidations, taken from the collateral bonus given to the liquidator, expressed in BPS.
struct DynamicReserveConfig {
uint16 collateralFactor;
uint32 maxLiquidationBonus;
uint16 liquidationFee;
}
/// @notice Liquidation configuration data.
/// @dev targetHealthFactor The ideal health factor to restore a user position during liquidation, expressed in WAD.
/// @dev healthFactorForMaxBonus The health factor under which liquidation bonus is maximum, expressed in WAD.
/// @dev liquidationBonusFactor The value multiplied by `maxLiquidationBonus` to compute the minimum liquidation bonus, expressed in BPS.
struct LiquidationConfig {
uint128 targetHealthFactor;
uint64 healthFactorForMaxBonus;
uint16 liquidationBonusFactor;
}
/// @notice User position data per reserve.
/// @dev drawnShares The drawn shares of the user position.
/// @dev premiumShares The premium shares of the user position.
/// @dev premiumOffsetRay The premium offset of the user position, used to calculate the premium, expressed in asset units and scaled by RAY.
/// @dev suppliedShares The supplied shares of the user position.
/// @dev dynamicConfigKey The key of the user position dynamic config.
struct UserPosition {
uint120 drawnShares;
uint120 premiumShares;
//
int200 premiumOffsetRay;
//
uint120 suppliedShares;
uint32 dynamicConfigKey;
}
/// @notice Position manager configuration data.
/// @dev approval The mapping of position manager user approvals.
/// @dev active True if the position manager is active.
struct PositionManagerConfig {
mapping(address user => bool) approval;
bool active;
}
/// @notice User position status data.
/// @dev map The map of bitmap buckets for the position status.
/// @dev riskPremium The risk premium of the user position, expressed in BPS.
struct PositionStatus {
mapping(uint256 bucket => uint256) map;
uint24 riskPremium;
}
/// @notice User account data describing a user position and its health.
/// @dev riskPremium The risk premium of the user position, expressed in BPS.
/// @dev avgCollateralFactor The weighted average collateral factor of the user position, expressed in WAD.
/// @dev healthFactor The health factor of the user position, expressed in WAD. 1e18 represents a health factor of 1.00.
/// @dev totalCollateralValue The total collateral value of the user position, expressed in units of Value.
/// @dev totalDebtValueRay The total debt value of the user position, expressed in units of Value and scaled by RAY.
/// @dev activeCollateralCount The number of active collaterals, which includes reserves with `collateralFactor` > 0, `enabledAsCollateral` and `suppliedAmount` > 0.
/// @dev borrowCount The number of borrowed reserves of the user position.
struct UserAccountData {
uint256 riskPremium;
uint256 avgCollateralFactor;
uint256 healthFactor;
uint256 totalCollateralValue;
uint256 totalDebtValueRay;
uint256 activeCollateralCount;
uint256 borrowCount;
}
/// @notice Emitted when the immutable variables of the Spoke are set.
/// @param oracle The address of the oracle.
/// @param maxUserReservesLimit The max user reserves limit.
event SetSpokeImmutables(address indexed oracle, uint16 maxUserReservesLimit);
/// @notice Emitted when a liquidation config is updated.
/// @param config The new liquidation config.
event UpdateLiquidationConfig(LiquidationConfig config);
/// @notice Emitted when a reserve is added.
/// @param reserveId The identifier of the reserve.
/// @param assetId The identifier of the asset.
/// @param hub The address of the Hub where the asset is listed.
event AddReserve(uint256 indexed reserveId, uint256 indexed assetId, address indexed hub);
/// @notice Emitted when a reserve configuration is updated.
/// @param reserveId The identifier of the reserve.
/// @param config The reserve configuration.
event UpdateReserveConfig(uint256 indexed reserveId, ReserveConfig config);
/// @notice Emitted when the price source of a reserve is updated.
/// @param reserveId The identifier of the reserve.
/// @param priceSource The address of the new price source.
event UpdateReservePriceSource(uint256 indexed reserveId, address indexed priceSource);
/// @notice Emitted when a dynamic reserve config is added.
/// @dev The config key is the next available key for the reserve, which is now the latest config
/// key of the reserve.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the added dynamic config.
/// @param config The dynamic reserve config.
event AddDynamicReserveConfig(
uint256 indexed reserveId,
uint32 indexed dynamicConfigKey,
DynamicReserveConfig config
);
/// @notice Emitted when a dynamic reserve config is updated.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the updated dynamic config.
/// @param config The dynamic reserve config.
event UpdateDynamicReserveConfig(
uint256 indexed reserveId,
uint32 indexed dynamicConfigKey,
DynamicReserveConfig config
);
/// @notice Emitted on updatePositionManager action.
/// @param positionManager The address of the position manager.
/// @param active True if position manager has become active.
event UpdatePositionManager(address indexed positionManager, bool active);
/// @notice Emitted on the supply action.
/// @param reserveId The reserve identifier of the underlying asset.
/// @param caller The transaction initiator, and supplier of the underlying asset.
/// @param user The owner of the modified position.
/// @param suppliedShares The amount of supply shares minted.
/// @param suppliedAmount The amount of underlying asset supplied.
event Supply(
uint256 indexed reserveId,
address indexed caller,
address indexed user,
uint256 suppliedShares,
uint256 suppliedAmount
);
/// @notice Emitted on the withdraw action.
/// @param reserveId The reserve identifier of the underlying asset.
/// @param caller The transaction initiator, and recipient of the underlying asset being withdrawn.
/// @param user The owner of the modified position.
/// @param withdrawnShares The amount of supply shares burned.
/// @param withdrawnAmount The amount of underlying asset withdrawn.
event Withdraw(
uint256 indexed reserveId,
address indexed caller,
address indexed user,
uint256 withdrawnShares,
uint256 withdrawnAmount
);
/// @notice Emitted on the borrow action.
/// @param reserveId The reserve identifier of the underlying asset.
/// @param caller The transaction initiator, and recipient of the underlying asset being borrowed.
/// @param user The owner of the position on which debt is generated.
/// @param drawnShares The amount of debt shares minted.
/// @param drawnAmount The amount of underlying asset borrowed.
event Borrow(
uint256 indexed reserveId,
address indexed caller,
address indexed user,
uint256 drawnShares,
uint256 drawnAmount
);
/// @notice Emitted on the repay action.
/// @param reserveId The reserve identifier of the underlying asset.
/// @param caller The transaction initiator who is repaying the underlying asset.
/// @param user The owner of the position whose debt is being repaid.
/// @param drawnShares The amount of drawn shares burned.
/// @param totalAmountRepaid The amount of drawn and premium underlying assets repaid.
/// @param premiumDelta A struct representing the changes to premium debt after repayment.
event Repay(
uint256 indexed reserveId,
address indexed caller,
address indexed user,
uint256 drawnShares,
uint256 totalAmountRepaid,
IHubBase.PremiumDelta premiumDelta
);
/// @dev Emitted when a borrower is liquidated.
/// @param collateralReserveId The identifier of the reserve used as collateral, to receive as a result of the liquidation.
/// @param debtReserveId The identifier of the reserve to be repaid with the liquidation.
/// @param user The address of the borrower getting liquidated.
/// @param liquidator The address of the liquidator.
/// @param receiveShares True if the liquidator received collateral in supplied shares rather than underlying assets.
/// @param debtAmountRestored The amount of debt restored, expressed in asset units.
/// @param drawnSharesLiquidated The amount of drawn shares liquidated.
/// @param premiumDelta A struct representing the changes to premium debt after liquidation.
/// @param collateralAmountRemoved The amount of collateral removed, expressed in asset units.
/// @param collateralSharesLiquidated The total amount of collateral shares liquidated.
/// @param collateralSharesToLiquidator The amount of collateral shares that the liquidator received.
event LiquidationCall(
uint256 indexed collateralReserveId,
uint256 indexed debtReserveId,
address indexed user,
address liquidator,
bool receiveShares,
uint256 debtAmountRestored,
uint256 drawnSharesLiquidated,
IHubBase.PremiumDelta premiumDelta,
uint256 collateralAmountRemoved,
uint256 collateralSharesLiquidated,
uint256 collateralSharesToLiquidator
);
/// @notice Emitted when a reserve deficit is reported to the Hub.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @param drawnShares The amount of drawn shares reported as deficit.
/// @param premiumDelta The premium delta data struct reported as deficit.
event ReportDeficit(
uint256 indexed reserveId,
address indexed user,
uint256 drawnShares,
IHubBase.PremiumDelta premiumDelta
);
/// @notice Emitted on setUsingAsCollateral action.
/// @param reserveId The reserve identifier of the underlying asset.
/// @param caller The transaction initiator.
/// @param user The owner of the position being modified.
/// @param usingAsCollateral Whether the reserve is enabled or disabled as collateral.
event SetUsingAsCollateral(
uint256 indexed reserveId,
address indexed caller,
address indexed user,
bool usingAsCollateral
);
/// @notice Emitted on updateUserRiskPremium action.
/// @param user The owner of the position being modified.
/// @param riskPremium The new risk premium (BPS) value of user.
event UpdateUserRiskPremium(address indexed user, uint256 riskPremium);
/// @notice Emitted when a user's dynamic config is refreshed for all reserves to their latest config key.
/// @param user The address of the user.
event RefreshAllUserDynamicConfig(address indexed user);
/// @notice Emitted when a user's dynamic config is refreshed for a single reserve to its latest config key.
/// @param user The address of the user.
/// @param reserveId The identifier of the reserve.
event RefreshSingleUserDynamicConfig(address indexed user, uint256 reserveId);
/// @notice Emitted on setUserPositionManager or renouncePositionManagerRole action.
/// @param user The address of the user on whose behalf position manager can act.
/// @param positionManager The address of the position manager.
/// @param approve True if position manager approval was granted, false if it was revoked.
event SetUserPositionManager(address indexed user, address indexed positionManager, bool approve);
/// @notice Emitted on refreshPremiumDebt action.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @param premiumDelta The change in premium values.
event RefreshPremiumDebt(
uint256 indexed reserveId,
address indexed user,
IHubBase.PremiumDelta premiumDelta
);
/// @notice Thrown when an asset is not listed on the Hub when adding a reserve.
error AssetNotListed();
/// @notice Thrown when adding a new reserve if that reserve already exists for a given Hub/assetId pair.
error ReserveExists();
/// @notice Thrown when adding a new reserve if an asset id is invalid.
error InvalidAssetId();
/// @notice Thrown when adding a new reserve if the asset decimals are invalid.
error InvalidAssetDecimals();
/// @notice Thrown when updating a reserve if it is not listed.
error ReserveNotListed();
/// @notice Thrown when a reserve is not borrowable during a `borrow` action.
error ReserveNotBorrowable();
/// @notice Thrown when a reserve is paused during an attempted action.
error ReservePaused();
/// @notice Thrown when a reserve is frozen.
/// @dev Can only occur during an attempted `supply`, `borrow`, or `setUsingAsCollateral` action.
error ReserveFrozen();
/// @notice Thrown when an action causes a user's health factor to fall below the liquidation threshold.
error HealthFactorBelowThreshold();
/// @notice Thrown when reserve is not enabled as collateral during liquidation.
error ReserveNotEnabledAsCollateral();
/// @notice Thrown when a specified reserve is not supplied by the user during liquidation.
error ReserveNotSupplied();
/// @notice Thrown when a specified reserve is not borrowed by the user during liquidation.
error ReserveNotBorrowed();
/// @notice Thrown when an unauthorized caller attempts an action.
error Unauthorized();
/// @notice Thrown if a config key is uninitialized when updating a dynamic reserve config.
error DynamicConfigKeyUninitialized();
/// @notice Thrown for an invalid zero address.
error InvalidAddress();
/// @notice Thrown when the oracle decimals are not 8 in the constructor.
error InvalidOracleDecimals();
/// @notice Thrown when the maximum user reserves limit is zero in the constructor.
error InvalidMaxUserReservesLimit();
/// @notice Thrown when a collateral risk exceeds the maximum allowed.
error InvalidCollateralRisk();
/// @notice Thrown if a liquidation config is invalid when it is updated.
error InvalidLiquidationConfig();
/// @notice Thrown when a liquidation fee is invalid.
error InvalidLiquidationFee();
/// @notice Thrown when a collateral factor and max liquidation bonus are invalid.
error InvalidCollateralFactorAndMaxLiquidationBonus();
/// @notice Thrown when trying to set zero collateralFactor on historic dynamic configuration keys.
error InvalidCollateralFactor();
/// @notice Thrown when a self-liquidation is attempted.
error SelfLiquidation();
/// @notice Thrown during liquidation when a user's health factor is not below the liquidation threshold.
error HealthFactorNotBelowThreshold();
/// @notice Thrown when collateral or debt dust remains after a liquidation, and neither reserve is fully liquidated.
error MustNotLeaveDust();
/// @notice Thrown when a debt to cover input is zero.
error InvalidDebtToCover();
/// @notice Thrown when the liquidator tries to receive shares for a collateral reserve that is frozen or is not enabled to receive shares.
error CannotReceiveShares();
/// @notice Thrown when the maximum number of dynamic config keys is reached.
error MaximumDynamicConfigKeyReached();
/// @notice Thrown when user attempts to exceed either the maximum allowed collateral or borrowed reserves.
error MaximumUserReservesExceeded();
/// @notice Updates the liquidation config.
/// @param config The new liquidation config.
function updateLiquidationConfig(LiquidationConfig calldata config) external;
/// @notice Adds a new reserve to the Spoke.
/// @dev Allowed even if the Spoke has not yet been added to the Hub.
/// @dev Allowed even if the `active` flag is `false`.
/// @dev Allowed even if the Spoke has been added but the `addCap` is zero.
/// @param hub The address of the Hub where the asset is listed.
/// @param assetId The identifier of the asset in the Hub.
/// @param priceSource The address of the price source for the asset.
/// @param config The initial reserve configuration.
/// @param dynamicConfig The initial dynamic reserve configuration.
/// @return The identifier of the newly added reserve.
function addReserve(
address hub,
uint256 assetId,
address priceSource,
ReserveConfig calldata config,
DynamicReserveConfig calldata dynamicConfig
) external returns (uint256);
/// @notice Updates the reserve config for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @param params The new reserve config.
function updateReserveConfig(uint256 reserveId, ReserveConfig calldata params) external;
/// @notice Updates the price source of a reserve.
/// @param reserveId The identifier of the reserve.
/// @param priceSource The address of the price source.
function updateReservePriceSource(uint256 reserveId, address priceSource) external;
/// @notice Updates the dynamic reserve config for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev Appends dynamic config to the next available key; reverts if `MAX_ALLOWED_DYNAMIC_CONFIG_KEY` is reached.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfig The new dynamic reserve config.
/// @return dynamicConfigKey The key of the added dynamic config.
function addDynamicReserveConfig(
uint256 reserveId,
DynamicReserveConfig calldata dynamicConfig
) external returns (uint32 dynamicConfigKey);
/// @notice Updates the dynamic reserve config for a given reserve at the specified key.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev Reverts with `DynamicConfigKeyUninitialized` if the config key has not been initialized yet.
/// @dev Reverts with `InvalidCollateralFactor` if the collateral factor is 0.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the config to update.
/// @param dynamicConfig The new dynamic reserve config.
function updateDynamicReserveConfig(
uint256 reserveId,
uint32 dynamicConfigKey,
DynamicReserveConfig calldata dynamicConfig
) external;
/// @notice Allows an approved caller (admin) to toggle the active status of position manager.
/// @param positionManager The address of the position manager.
/// @param active True if positionManager is to be set as active.
function updatePositionManager(address positionManager, bool active) external;
/// @notice Supplies an amount of underlying asset of the specified reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The Spoke pulls the underlying asset from the caller, so prior token approval is required.
/// @dev Caller must be `onBehalfOf` or an authorized position manager for `onBehalfOf`.
/// @param reserveId The reserve identifier.
/// @param amount The amount of asset to supply.
/// @param onBehalfOf The owner of the position to add supply shares to.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supply(
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Withdraws a specified amount of underlying asset from the given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev Providing an amount greater than the maximum withdrawable value signals a full withdrawal.
/// @dev Caller must be `onBehalfOf` or an authorized position manager for `onBehalfOf`.
/// @dev Caller receives the underlying asset withdrawn.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of asset to withdraw.
/// @param onBehalfOf The owner of position to remove supply shares from.
/// @return The amount of shares withdrawn.
/// @return The amount of assets withdrawn.
function withdraw(
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Borrows a specified amount of underlying asset from the given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev It reverts if the user would borrow more than the maximum allowed number of borrowed reserves.
/// @dev Caller must be `onBehalfOf` or an authorized position manager for `onBehalfOf`.
/// @dev Caller receives the underlying asset borrowed.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of asset to borrow.
/// @param onBehalfOf The owner of the position against which debt is generated.
/// @return The amount of shares borrowed.
/// @return The amount of assets borrowed.
function borrow(
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Repays a specified amount of underlying asset to a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The Spoke pulls the underlying asset from the caller, so prior approval is required.
/// @dev Caller must be `onBehalfOf` or an authorized position manager for `onBehalfOf`.
/// @param reserveId The identifier of the reserve.
/// @param amount The amount of asset to repay.
/// @param onBehalfOf The owner of the position whose debt is repaid.
/// @return The amount of shares repaid.
/// @return The amount of assets repaid.
function repay(
uint256 reserveId,
uint256 amount,
address onBehalfOf
) external returns (uint256, uint256);
/// @notice Liquidates a user position.
/// @dev It reverts if the reserves associated with any of the given reserve identifiers are not listed.
/// @dev The Spoke pulls underlying repaid debt assets from caller (Liquidator), hence it needs prior approval.
/// @param collateralReserveId The reserveId of the underlying asset used as collateral by the liquidated user.
/// @param debtReserveId The reserveId of the underlying asset borrowed by the liquidated user, to be repaid by Liquidator.
/// @param user The address of the user to liquidate.
/// @param debtToCover The desired amount of debt to cover.
/// @param receiveShares True to receive collateral in supplied shares, false to receive in underlying assets.
function liquidationCall(
uint256 collateralReserveId,
uint256 debtReserveId,
address user,
uint256 debtToCover,
bool receiveShares
) external;
/// @notice Allows suppliers to enable/disable a specific supplied reserve as collateral.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev It reverts if the user exceeds the maximum allowed collateral reserves when enabling.
/// @dev Reserves with zero supplied or zero collateral factor count towards the max allowed collateral reserves.
/// @dev Caller must be `onBehalfOf` or an authorized position manager for `onBehalfOf`.
/// @param reserveId The reserve identifier of the underlying asset.
/// @param usingAsCollateral True if the user wants to use the supply as collateral.
/// @param onBehalfOf The owner of the position being modified.
function setUsingAsCollateral(
uint256 reserveId,
bool usingAsCollateral,
address onBehalfOf
) external;
/// @notice Allows updating the risk premium on onBehalfOf position.
/// @dev Caller must be `onBehalfOf`, an authorized position manager for `onBehalfOf`, or admin.
/// @param onBehalfOf The owner of the position being modified.
function updateUserRiskPremium(address onBehalfOf) external;
/// @notice Allows updating the dynamic configuration for all collateral reserves on onBehalfOf position.
/// @dev Caller must be `onBehalfOf`, an authorized position manager for `onBehalfOf`, or admin.
/// @param onBehalfOf The owner of the position being modified.
function updateUserDynamicConfig(address onBehalfOf) external;
/// @notice Enables a user to grant or revoke approval for a position manager.
/// @dev Allows approving inactive position managers.
/// @param positionManager The address of the position manager.
/// @param approve True to approve the position manager, false to revoke approval.
function setUserPositionManager(address positionManager, bool approve) external;
/// @notice Enables a user to grant or revoke approval for an array of position managers using an EIP712-typed intent.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @dev Allows duplicated updates and the last one is persisted. Allows approving inactive position managers.
/// @param params The structured setUserPositionManagers parameter.
/// @param signature The EIP712-compliant signature bytes.
function setUserPositionManagersWithSig(
SetUserPositionManagers calldata params,
bytes calldata signature
) external;
/// @notice Allows position manager (as caller) to renounce their approval given by the user.
/// @param user The address of the user.
function renouncePositionManagerRole(address user) external;
/// @notice Allows consuming a permit signature for the given reserve's underlying asset.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The Spoke must be configured as the spender.
/// @param reserveId The identifier of the reserve.
/// @param onBehalfOf The address of the user on whose behalf the permit is being used.
/// @param value The amount of the underlying asset to permit.
/// @param deadline The deadline for the permit.
/// @param permitV The v parameter of the permit signature.
/// @param permitR The r parameter of the permit signature.
/// @param permitS The s parameter of the permit signature.
function permitReserve(
uint256 reserveId,
address onBehalfOf,
uint256 value,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external;
/// @notice Returns the liquidation config struct.
function getLiquidationConfig() external view returns (LiquidationConfig memory);
/// @notice Returns the number of listed reserves on the Spoke.
/// @dev Count includes reserves that are not currently active.
function getReserveCount() external view returns (uint256);
/// @notice Returns the total amount of supplied assets of a given reserve.
/// @param reserveId The identifier of the reserve.
/// @return The amount of supplied assets.
function getReserveSuppliedAssets(uint256 reserveId) external view returns (uint256);
/// @notice Returns the total amount of supplied shares of a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @return The amount of supplied shares.
function getReserveSuppliedShares(uint256 reserveId) external view returns (uint256);
/// @notice Returns the debt of a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The total debt of the reserve is the sum of drawn debt and premium debt.
/// @param reserveId The identifier of the reserve.
/// @return The amount of drawn debt.
/// @return The amount of premium debt.
function getReserveDebt(uint256 reserveId) external view returns (uint256, uint256);
/// @notice Returns the total debt of a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The total debt of the reserve is the sum of drawn debt and premium debt.
/// @param reserveId The identifier of the reserve.
/// @return The total debt amount.
function getReserveTotalDebt(uint256 reserveId) external view returns (uint256);
/// @notice Returns the reserve identifier for a given asset in a Hub.
/// @dev It reverts if no reserve is associated with the given asset identifier.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset on the Hub.
/// @return The identifier of the reserve.
function getReserveId(address hub, uint256 assetId) external view returns (uint256);
/// @notice Returns the reserve struct data in storage.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @return The reserve struct.
function getReserve(uint256 reserveId) external view returns (Reserve memory);
/// @notice Returns the reserve configuration struct data in storage.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @return The reserve configuration struct.
function getReserveConfig(uint256 reserveId) external view returns (ReserveConfig memory);
/// @notice Returns the dynamic reserve configuration struct at the specified key.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev Does not revert if `dynamicConfigKey` is unset.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the dynamic config.
/// @return The dynamic reserve configuration struct.
function getDynamicReserveConfig(
uint256 reserveId,
uint32 dynamicConfigKey
) external view returns (DynamicReserveConfig memory);
/// @notice Returns two flags indicating whether the reserve is used as collateral and whether it is borrowed by the user.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev Even if enabled as collateral, it will only count towards user position if the collateral factor is greater than 0.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return True if the reserve is enabled as collateral by the user.
/// @return True if the reserve is borrowed by the user.
function getUserReserveStatus(uint256 reserveId, address user) external view returns (bool, bool);
/// @notice Returns the amount of assets supplied by a specific user for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return The amount of assets supplied by the user.
function getUserSuppliedAssets(uint256 reserveId, address user) external view returns (uint256);
/// @notice Returns the amount of shares supplied by a specific user for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return The amount of shares supplied by the user.
function getUserSuppliedShares(uint256 reserveId, address user) external view returns (uint256);
/// @notice Returns the debt of a specific user for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The total debt of the user is the sum of drawn debt and premium debt.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return The amount of drawn debt.
/// @return The amount of premium debt.
function getUserDebt(uint256 reserveId, address user) external view returns (uint256, uint256);
/// @notice Returns the total debt of a specific user for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @dev The total debt of the user is the sum of drawn debt and premium debt.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return The total debt amount.
function getUserTotalDebt(uint256 reserveId, address user) external view returns (uint256);
/// @notice Returns the full precision premium debt of a specific user for a given reserve.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return The amount of premium debt, expressed in asset units and scaled by RAY.
function getUserPremiumDebtRay(uint256 reserveId, address user) external view returns (uint256);
/// @notice Returns the user position struct in storage.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @return The user position struct.
function getUserPosition(
uint256 reserveId,
address user
) external view returns (UserPosition memory);
/// @notice Returns the most up-to-date user account data information.
/// @dev Utilizes user's current dynamic configuration of user position.
/// @param user The address of the user.
/// @return The user account data struct.
function getUserAccountData(address user) external view returns (UserAccountData memory);
/// @notice Returns the risk premium from the user's last position update.
/// @param user The address of the user.
/// @return The risk premium of the user from the last position update, expressed in BPS.
function getUserLastRiskPremium(address user) external view returns (uint256);
/// @notice Returns the liquidation bonus for a given health factor, based on the user's current dynamic configuration.
/// @dev It reverts if the reserve associated with the given reserve identifier is not listed.
/// @param reserveId The identifier of the reserve.
/// @param user The address of the user.
/// @param healthFactor The health factor of the user, expressed in WAD.
/// @return The liquidation bonus for the user, expressed in BPS.
function getLiquidationBonus(
uint256 reserveId,
address user,
uint256 healthFactor
) external view returns (uint256);
/// @notice Returns whether positionManager is currently activated by governance.
/// @param positionManager The address of the position manager.
/// @return True if positionManager is currently active.
function isPositionManagerActive(address positionManager) external view returns (bool);
/// @notice Returns whether positionManager is active and approved by user.
/// @param user The address of the user.
/// @param positionManager The address of the position manager.
/// @return True if positionManager is active and approved by user.
function isPositionManager(address user, address positionManager) external view returns (bool);
/// @notice Returns the address of the external `LiquidationLogic` library.
function getLiquidationLogic() external pure returns (address);
/// @notice Returns the type hash for the SetUserPositionManagers intent.
/// @return The bytes-encoded EIP-712 struct hash representing the intent.
function SET_USER_POSITION_MANAGERS_TYPEHASH() external view returns (bytes32);
/// @notice Returns the address of the AaveOracle contract.
function ORACLE() external view returns (address);
/// @notice Returns the maximum allowed number of collateral and borrow reserves per user (each counted separately).
function MAX_USER_RESERVES_LIMIT() external view returns (uint16);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ISpokeConfigurator.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {ISpoke} from 'src/spoke/interfaces/ISpoke.sol';
/// @title ISpokeConfigurator
/// @author Aave Labs
/// @notice Interface for the SpokeConfigurator.
interface ISpokeConfigurator {
/// @notice Thrown when an address parameter is the zero address.
error InvalidAddress();
/// @notice Updates the price source of a reserve.
/// @dev The price source must implement IPriceFeed.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param priceSource The new price source.
function updateReservePriceSource(address spoke, uint256 reserveId, address priceSource) external;
/// @notice Updates the liquidation target health factor of a spoke.
/// @param spoke The address of the Spoke.
/// @param targetHealthFactor The new liquidation target health factor.
function updateLiquidationTargetHealthFactor(address spoke, uint256 targetHealthFactor) external;
/// @notice Updates the health factor for max liquidation bonus of a spoke.
/// @param spoke The address of the Spoke.
/// @param healthFactorForMaxBonus The new health factor for max liquidation bonus.
function updateHealthFactorForMaxBonus(address spoke, uint256 healthFactorForMaxBonus) external;
/// @notice Updates the liquidation bonus factor of a spoke.
/// @param spoke The address of the Spoke.
/// @param liquidationBonusFactor The new liquidation bonus factor.
function updateLiquidationBonusFactor(address spoke, uint256 liquidationBonusFactor) external;
/// @notice Updates the liquidation config of a spoke.
/// @param spoke The address of the Spoke.
/// @param liquidationConfig The new liquidation config.
function updateLiquidationConfig(
address spoke,
ISpoke.LiquidationConfig calldata liquidationConfig
) external;
/// @notice Adds a new reserve to a spoke.
/// @dev The asset corresponding to the reserve must be already listed on the Hub.
/// @dev The price source must implement IPriceFeed.
/// @param spoke The address of the Spoke.
/// @param hub The address of the Hub where the asset corresponding to the reserve is listed.
/// @param assetId The identifier of the asset.
/// @param priceSource The address of the price source.
/// @param config The configuration of the reserve.
/// @param dynamicConfig The dynamic configuration of the reserve.
/// @return reserveId The identifier of the reserve.
function addReserve(
address spoke,
address hub,
uint256 assetId,
address priceSource,
ISpoke.ReserveConfig calldata config,
ISpoke.DynamicReserveConfig calldata dynamicConfig
) external returns (uint256);
/// @notice Updates the paused flag of a reserve.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param paused The new paused flag.
function updatePaused(address spoke, uint256 reserveId, bool paused) external;
/// @notice Updates the frozen flag of a reserve.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param frozen The new frozen flag.
function updateFrozen(address spoke, uint256 reserveId, bool frozen) external;
/// @notice Updates the borrowable flag of a reserve.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param borrowable The new borrowable flag.
function updateBorrowable(address spoke, uint256 reserveId, bool borrowable) external;
/// @notice Updates whether receiving shares on liquidation is enabled.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param receiveSharesEnabled The new receiveSharesEnabled flag.
function updateReceiveSharesEnabled(
address spoke,
uint256 reserveId,
bool receiveSharesEnabled
) external;
/// @notice Updates the collateral risk of a reserve.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param collateralRisk The new collateral risk.
function updateCollateralRisk(address spoke, uint256 reserveId, uint256 collateralRisk) external;
/// @notice Adds a dynamic config to a reserve, identical to the latest one but with the specified collateral factor.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param collateralFactor The new collateral factor.
/// @return The dynamicConfigKey of the added dynamic configuration.
function addCollateralFactor(
address spoke,
uint256 reserveId,
uint16 collateralFactor
) external returns (uint32);
/// @notice Updates an existing collateral factor of a reserve at the specified key.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the dynamic config to update.
/// @param collateralFactor The new collateral factor.
function updateCollateralFactor(
address spoke,
uint256 reserveId,
uint32 dynamicConfigKey,
uint16 collateralFactor
) external;
/// @notice Adds a dynamic config to a reserve, identical to the latest one but with the specified max liquidation bonus.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param maxLiquidationBonus The new max liquidation bonus.
/// @return The dynamicConfigKey of the added dynamic configuration.
function addMaxLiquidationBonus(
address spoke,
uint256 reserveId,
uint256 maxLiquidationBonus
) external returns (uint32);
/// @notice Updates an existing liquidation bonus of a reserve at the specified key.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the dynamic config to update.
/// @param maxLiquidationBonus The new liquidation bonus.
function updateMaxLiquidationBonus(
address spoke,
uint256 reserveId,
uint32 dynamicConfigKey,
uint256 maxLiquidationBonus
) external;
/// @notice Adds a dynamic config to a reserve, identical to the latest one but with the specified liquidation fee.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param liquidationFee The new liquidation fee.
/// @return The dynamicConfigKey of the added dynamic configuration.
function addLiquidationFee(
address spoke,
uint256 reserveId,
uint256 liquidationFee
) external returns (uint32);
/// @notice Updates an existing liquidation fee of a reserve at the specified key.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the dynamic config to update.
/// @param liquidationFee The new liquidation fee.
function updateLiquidationFee(
address spoke,
uint256 reserveId,
uint32 dynamicConfigKey,
uint256 liquidationFee
) external;
/// @notice Adds a dynamic config to a reserve.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfig The new dynamic config.
/// @return dynamicConfigKey The key of the added dynamic config.
function addDynamicReserveConfig(
address spoke,
uint256 reserveId,
ISpoke.DynamicReserveConfig calldata dynamicConfig
) external returns (uint32);
/// @notice Updates the dynamic config of a reserve at the specified key.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
/// @param dynamicConfigKey The key of the dynamic config to update.
/// @param dynamicConfig The new dynamic config.
function updateDynamicReserveConfig(
address spoke,
uint256 reserveId,
uint32 dynamicConfigKey,
ISpoke.DynamicReserveConfig calldata dynamicConfig
) external;
/// @notice Pauses all reserves of a spoke.
/// @param spoke The address of the Spoke.
function pauseAllReserves(address spoke) external;
/// @notice Freezes all reserves of a spoke.
/// @param spoke The address of the Spoke.
function freezeAllReserves(address spoke) external;
/// @notice Pauses a reserve of a spoke.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
function pauseReserve(address spoke, uint256 reserveId) external;
/// @notice Freezes a reserve of a spoke.
/// @param spoke The address of the Spoke.
/// @param reserveId The identifier of the reserve.
function freezeReserve(address spoke, uint256 reserveId) external;
/// @notice Updates the active flag of a spoke's position manager.
/// @param spoke The address of the Spoke.
/// @param positionManager The address of the position manager.
/// @param active The new active flag.
function updatePositionManager(address spoke, address positionManager, bool active) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ITokenizationSpoke.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
import {IERC2612, IERC20Permit} from 'src/dependencies/openzeppelin/IERC2612.sol';
import {IERC4626} from 'src/dependencies/openzeppelin/IERC4626.sol';
import {IIntentConsumer} from 'src/interfaces/IIntentConsumer.sol';
/// @title ITokenizationSpoke
/// @author Aave Labs
interface ITokenizationSpoke is IERC4626, IERC2612, IIntentConsumer {
/// @notice Intent data to deposit assets into the TokenizationSpoke.
/// @param depositor The address of the user depositing assets.
/// @param assets The amount of assets to deposit.
/// @param receiver The address that will receive the minted shares.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct TokenizedDeposit {
address depositor;
uint256 assets;
address receiver;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to mint shares from the TokenizationSpoke.
/// @param depositor The address of the user depositing assets.
/// @param shares The amount of shares to mint.
/// @param receiver The address that will receive the minted shares.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct TokenizedMint {
address depositor;
uint256 shares;
address receiver;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to withdraw assets from the TokenizationSpoke.
/// @param owner The address of the user withdrawing assets.
/// @param assets The amount of assets to withdraw.
/// @param receiver The address that will receive the withdrawn assets.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct TokenizedWithdraw {
address owner;
uint256 assets;
address receiver;
uint256 nonce;
uint256 deadline;
}
/// @notice Intent data to redeem shares from the TokenizationSpoke.
/// @param owner The address of the user redeeming shares.
/// @param shares The amount of shares to redeem.
/// @param receiver The address that will receive the redeemed assets.
/// @param nonce The key-prefixed nonce for the signature.
/// @param deadline The deadline for the intent.
struct TokenizedRedeem {
address owner;
uint256 shares;
address receiver;
uint256 nonce;
uint256 deadline;
}
/// @notice Emitted when the immutable variables of the TokenizationSpoke are set.
/// @param hub The address of the Hub.
/// @param assetId The identifier of the asset.
event SetTokenizationSpokeImmutables(address indexed hub, uint256 indexed assetId);
/// @notice Deposits assets into the TokenizationSpoke with a signature.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The parameters for the deposit.
/// @param signature The EIP712-typed signed bytes for the deposit.
/// @return The amount of shares minted.
function depositWithSig(
TokenizedDeposit calldata params,
bytes calldata signature
) external returns (uint256);
/// @notice Mints shares of the TokenizationSpoke with a signature.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The parameters for the mint.
/// @param signature The EIP712-typed signed bytes for the mint.
/// @return The amount of assets deposited.
function mintWithSig(
TokenizedMint calldata params,
bytes calldata signature
) external returns (uint256);
/// @notice Withdraws assets from the TokenizationSpoke with a signature.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The parameters for the withdraw.
/// @param signature The EIP712-typed signed bytes for the withdraw.
/// @return The amount of shares burnt.
function withdrawWithSig(
TokenizedWithdraw calldata params,
bytes calldata signature
) external returns (uint256);
/// @notice Redeems shares from the TokenizationSpoke with a signature.
/// @dev Uses keyed-nonces where for each key's namespace nonce is consumed sequentially.
/// @param params The parameters for the redeem.
/// @param signature The EIP712-typed signed bytes for the redeem.
/// @return The amount of assets burnt.
function redeemWithSig(
TokenizedRedeem calldata params,
bytes calldata signature
) external returns (uint256);
/// @notice Deposits assets into the vault with an underlying asset ERC2612-typed permit.
/// @param assets The amount of assets to deposit.
/// @param receiver The receiver of the shares.
/// @param deadline The deadline of the permit.
/// @param v The v value of the permit.
/// @param r The r value of the permit.
/// @param s The s value of the permit.
/// @return The amount of shares minted.
function depositWithPermit(
uint256 assets,
address receiver,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256);
/// @notice Sets approval for `spender` to spend `owner`'s share tokens via EIP712-typed signature.
/// @dev Uses keyed-nonces where the share token permit nonce is consumed sequentially and key namespace is always set to `PERMIT_NONCE_NAMESPACE`.
/// @dev Implements EIP-2612 permit functionality for the vault share token.
/// @param owner The address of the token owner granting approval.
/// @param spender The address being granted approval to spend tokens.
/// @param value The amount of tokens approved for spending.
/// @param deadline The timestamp by which the permit must be used.
/// @param v The recovery byte of the signature.
/// @param r The first 32 bytes of the signature.
/// @param s The second 32 bytes of the signature.
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/// @notice Revokes the current PERMIT_NAMESPACE_NONCE of caller & increments the nonce at this key.
/// @return The consumed keyed-nonce.
function usePermitNonce() external returns (uint256);
/// @notice Resets the allowance of an owner for the caller.
/// @param owner The owner of the allowance to renounce.
function renounceAllowance(address owner) external;
/// @notice Returns the address of the associated Hub.
function hub() external view returns (address);
/// @notice Returns the identifier of the associated asset.
function assetId() external view returns (uint256);
/// @notice Returns the maximum allowed spoke cap.
function MAX_ALLOWED_SPOKE_CAP() external view returns (uint40);
/// @notice Returns the nonce namespace for share token EIP-2612 permit signatures.
/// @dev Share token permits strictly use this dedicated namespace in the keyed-nonce system as the nonce key.
/// @dev Other vault intent operations can also use the this namespace as the nonce key.
function PERMIT_NONCE_NAMESPACE() external pure returns (uint192);
/// @notice Returns the type hash for the deposit intent.
function DEPOSIT_TYPEHASH() external pure returns (bytes32);
/// @notice Returns the type hash for the mint intent.
function MINT_TYPEHASH() external pure returns (bytes32);
/// @notice Returns the type hash for the withdraw intent.
function WITHDRAW_TYPEHASH() external pure returns (bytes32);
/// @notice Returns the type hash for the redeem intent.
function REDEEM_TYPEHASH() external pure returns (bytes32);
/// @notice Returns the type hash for the share token permit intent.
function PERMIT_TYPEHASH() external pure returns (bytes32);
/// @notice Returns the EIP-712 domain separator.
function DOMAIN_SEPARATOR()
external
view
override(IERC20Permit, IIntentConsumer)
returns (bytes32);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/spoke/interfaces/ITreasurySpoke.sol
// SPDX-License-Identifier: LicenseRef-BUSL
pragma solidity ^0.8.0;
/// @title ITreasurySpoke
/// @author Aave Labs
/// @notice Interface for the TreasurySpoke.
interface ITreasurySpoke {
/// @notice Supplies a specified amount of the underlying asset to the specified Hub.
/// @dev The Spoke pulls the underlying asset from the caller, so prior approval is required.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @param amount The amount of asset to supply.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supply(
address hub,
address underlying,
uint256 amount
) external returns (uint256, uint256);
/// @notice Supplies a specified amount of the underlying asset to the specified Hub.
/// @dev The underlying asset must already be transferred to the Hub before calling.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @param amount The amount of asset to supply.
/// @return The amount of shares supplied.
/// @return The amount of assets supplied.
function supplySkimmed(
address hub,
address underlying,
uint256 amount
) external returns (uint256, uint256);
/// @notice Withdraws a specified amount of underlying asset from the specified Hub.
/// @dev Providing an amount greater than the maximum withdrawable value signals a full withdrawal.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @param amount The amount of asset to withdraw.
/// @return The amount of shares withdrawn.
/// @return The amount of assets withdrawn.
function withdraw(
address hub,
address underlying,
uint256 amount
) external returns (uint256, uint256);
/// @notice Transfers a specified amount of ERC20 tokens from this contract.
/// @param token The address of the ERC20 token to transfer.
/// @param to The recipient address.
/// @param amount The amount of tokens to transfer.
function transfer(address token, address to, uint256 amount) external;
/// @notice Returns the amount of assets supplied by this spoke.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @return The amount of assets supplied.
function getSuppliedAssets(address hub, address underlying) external view returns (uint256);
/// @notice Returns the amount of shares supplied by this spoke.
/// @dev Shares are denominated relative to the supply side.
/// @param hub The address of the Hub.
/// @param underlying The address of the underlying asset.
/// @return The amount of shares supplied.
function getSuppliedShares(address hub, address underlying) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/src/AaveV4.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import {IHub} from 'aave-v4/hub/interfaces/IHub.sol';
import {IHubConfigurator} from 'aave-v4/hub/interfaces/IHubConfigurator.sol';
import {ISpoke} from 'aave-v4/spoke/interfaces/ISpoke.sol';
import {ISpokeConfigurator} from 'aave-v4/spoke/interfaces/ISpokeConfigurator.sol';
import {ITokenizationSpoke} from 'aave-v4/spoke/interfaces/ITokenizationSpoke.sol';
import {ITreasurySpoke} from 'aave-v4/spoke/interfaces/ITreasurySpoke.sol';
import {IAaveOracle} from 'aave-v4/spoke/interfaces/IAaveOracle.sol';
import {IConfigPositionManager} from 'aave-v4/position-manager/interfaces/IConfigPositionManager.sol';
import {IGiverPositionManager} from 'aave-v4/position-manager/interfaces/IGiverPositionManager.sol';
import {ITakerPositionManager} from 'aave-v4/position-manager/interfaces/ITakerPositionManager.sol';
import {INativeTokenGateway} from 'aave-v4/position-manager/interfaces/INativeTokenGateway.sol';
import {ISignatureGateway} from 'aave-v4/position-manager/interfaces/ISignatureGateway.sol';
import {IAaveV4ConfigEngine} from 'aave-v4/config-engine/interfaces/IAaveV4ConfigEngine.sol';
import {IAccessManagerEnumerable} from 'aave-v4/access/interfaces/IAccessManagerEnumerable.sol';
import {IBasicInterestRateStrategy} from 'aave-v4/hub/interfaces/IBasicInterestRateStrategy.sol';
struct PositionManagers {
IGiverPositionManager giver;
ITakerPositionManager taker;
IConfigPositionManager config;
INativeTokenGateway nativeGateway;
ISignatureGateway signatureGateway;
}
lib/aave-helpers/lib/aave-address-book/src/AaveV4Ethereum.sol
// AUTOGENERATED - MANUAL CHANGES WILL BE REVERTED BY THE GENERATOR
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import {IHub, IHubConfigurator, ISpoke, ISpokeConfigurator, ITokenizationSpoke, ITreasurySpoke, IAaveOracle, IConfigPositionManager, IGiverPositionManager, ITakerPositionManager, INativeTokenGateway, ISignatureGateway, IAaveV4ConfigEngine, IAccessManagerEnumerable, IBasicInterestRateStrategy, PositionManagers} from './AaveV4.sol';
library AaveV4Ethereum {
// https://etherscan.io/address/0x08aE3BE30958cDd1847ec58fFfd4C451a87fDF01
IAccessManagerEnumerable internal constant ACCESS_MANAGER =
IAccessManagerEnumerable(0x08aE3BE30958cDd1847ec58fFfd4C451a87fDF01);
// https://etherscan.io/address/0x1F0753480bB03EaA00863224602267B7E0525C3d
IHubConfigurator internal constant HUB_CONFIGURATOR =
IHubConfigurator(0x1F0753480bB03EaA00863224602267B7E0525C3d);
// https://etherscan.io/address/0x9BFFf48BFb5A7AE70c348d4d4cb97E8DEFa5389a
ISpokeConfigurator internal constant SPOKE_CONFIGURATOR =
ISpokeConfigurator(0x9BFFf48BFb5A7AE70c348d4d4cb97E8DEFa5389a);
// https://etherscan.io/address/0xB9B0b8616f6Bf6841972a52058132BE08d723155
ITreasurySpoke internal constant TREASURY_SPOKE =
ITreasurySpoke(0xB9B0b8616f6Bf6841972a52058132BE08d723155);
// https://etherscan.io/address/0xa1673fbD457747A05e91D9ef904Cb12827916B1E
IAaveV4ConfigEngine internal constant CONFIG_ENGINE =
IAaveV4ConfigEngine(0xa1673fbD457747A05e91D9ef904Cb12827916B1E);
// https://etherscan.io/address/0x6f48d9Cdb8EE6E17c96B2d8Aec128af426A295c1
address internal constant RISK_STEWARD = 0x6f48d9Cdb8EE6E17c96B2d8Aec128af426A295c1;
// https://etherscan.io/address/0x47c71dFEB55Ebaa431Ae3fbF99Ea50e0D3d30fA8
address internal constant RISK_COUNCIL = 0x47c71dFEB55Ebaa431Ae3fbF99Ea50e0D3d30fA8;
}
library AaveV4EthereumHubs {
// https://etherscan.io/address/0xCca852Bc40e560adC3b1Cc58CA5b55638ce826c9
IHub internal constant CORE_HUB = IHub(0xCca852Bc40e560adC3b1Cc58CA5b55638ce826c9);
// https://etherscan.io/address/0x06002e9c4412CB7814a791eA3666D905871E536A
IHub internal constant PLUS_HUB = IHub(0x06002e9c4412CB7814a791eA3666D905871E536A);
// https://etherscan.io/address/0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931
IHub internal constant PRIME_HUB = IHub(0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931);
// https://etherscan.io/address/0x62d63197660c080236193CA60b70E49A08E90368
IHub internal constant GLOBAL_DOLLAR_HUB = IHub(0x62d63197660c080236193CA60b70E49A08E90368);
}
library AaveV4EthereumSpokes {
// https://etherscan.io/address/0xB9B0b8616f6Bf6841972a52058132BE08d723155
ITreasurySpoke internal constant TREASURY_SPOKE =
ITreasurySpoke(0xB9B0b8616f6Bf6841972a52058132BE08d723155);
// https://etherscan.io/address/0x973a023A77420ba610f06b3858aD991Df6d85A08
ISpoke internal constant BLUECHIP_SPOKE = ISpoke(0x973a023A77420ba610f06b3858aD991Df6d85A08);
// https://etherscan.io/address/0xdA1266a7b8620819dAE3F8bd6B546Da36e505bB8
IAaveOracle internal constant BLUECHIP_SPOKE_ORACLE =
IAaveOracle(0xdA1266a7b8620819dAE3F8bd6B546Da36e505bB8);
// https://etherscan.io/address/0x58131E79531caB1d52301228d1f7b842F26B9649
ISpoke internal constant ETHENA_CORRELATED_SPOKE =
ISpoke(0x58131E79531caB1d52301228d1f7b842F26B9649);
// https://etherscan.io/address/0x9b91a0943CADf554742E8Fb358B1cC4ae4F85F01
IAaveOracle internal constant ETHENA_CORRELATED_SPOKE_ORACLE =
IAaveOracle(0x9b91a0943CADf554742E8Fb358B1cC4ae4F85F01);
// https://etherscan.io/address/0xba1B3D55D249692b669A164024A838309B7508AF
ISpoke internal constant ETHENA_ECOSYSTEM_SPOKE =
ISpoke(0xba1B3D55D249692b669A164024A838309B7508AF);
// https://etherscan.io/address/0xc390dbe9fc00D6db73C52d375642b47008C33c90
IAaveOracle internal constant ETHENA_ECOSYSTEM_SPOKE_ORACLE =
IAaveOracle(0xc390dbe9fc00D6db73C52d375642b47008C33c90);
// https://etherscan.io/address/0xD8B93635b8C6d0fF98CbE90b5988E3F2d1Cd9da1
ISpoke internal constant FOREX_SPOKE = ISpoke(0xD8B93635b8C6d0fF98CbE90b5988E3F2d1Cd9da1);
// https://etherscan.io/address/0xB3CE6E7b6d389a66eA4a3777bA07219d00FB3a9D
IAaveOracle internal constant FOREX_SPOKE_ORACLE =
IAaveOracle(0xB3CE6E7b6d389a66eA4a3777bA07219d00FB3a9D);
// https://etherscan.io/address/0x65407b940966954b23dfA3caA5C0702bB42984DC
ISpoke internal constant GOLD_SPOKE = ISpoke(0x65407b940966954b23dfA3caA5C0702bB42984DC);
// https://etherscan.io/address/0x0083421fd178749af2201ddA5A7C3feB5790B80c
IAaveOracle internal constant GOLD_SPOKE_ORACLE =
IAaveOracle(0x0083421fd178749af2201ddA5A7C3feB5790B80c);
// https://etherscan.io/address/0x7EC68b5695e803e98a21a9A05d744F28b0a7753D
ISpoke internal constant LOMBARD_BTC_SPOKE = ISpoke(0x7EC68b5695e803e98a21a9A05d744F28b0a7753D);
// https://etherscan.io/address/0x198Cac7f54FFc7d709Ac0FEc4B6454CE73e21D3D
IAaveOracle internal constant LOMBARD_BTC_SPOKE_ORACLE =
IAaveOracle(0x198Cac7f54FFc7d709Ac0FEc4B6454CE73e21D3D);
// https://etherscan.io/address/0x94e7A5dCbE816e498b89aB752661904E2F56c485
ISpoke internal constant MAIN_SPOKE = ISpoke(0x94e7A5dCbE816e498b89aB752661904E2F56c485);
// https://etherscan.io/address/0x99B2B6CEa9C3D2fd8F4d90f86741C44B212a6127
IAaveOracle internal constant MAIN_SPOKE_ORACLE =
IAaveOracle(0x99B2B6CEa9C3D2fd8F4d90f86741C44B212a6127);
// https://etherscan.io/address/0xAD75cE6354f87F3135cE10621d385d8D1e2562C2
ISpoke internal constant PAXG_GOLD_SPOKE = ISpoke(0xAD75cE6354f87F3135cE10621d385d8D1e2562C2);
// https://etherscan.io/address/0x8CEcC12b23ED45EC2A9b9EB57EA6974c0cae850B
IAaveOracle internal constant PAXG_GOLD_SPOKE_ORACLE =
IAaveOracle(0x8CEcC12b23ED45EC2A9b9EB57EA6974c0cae850B);
// https://etherscan.io/address/0x956d8e0A89cfa3744428C4641b5a53B56167a7f9
ISpoke internal constant USDG_PENDLE_SPOKE = ISpoke(0x956d8e0A89cfa3744428C4641b5a53B56167a7f9);
// https://etherscan.io/address/0x692cD2F7653680aFf316Ac309ce825FCF573B7Ee
IAaveOracle internal constant USDG_PENDLE_SPOKE_ORACLE =
IAaveOracle(0x692cD2F7653680aFf316Ac309ce825FCF573B7Ee);
// https://etherscan.io/address/0xbF10BDfE177dE0336aFD7fcCF80A904E15386219
ISpoke internal constant ETHERFI_ESPOKE = ISpoke(0xbF10BDfE177dE0336aFD7fcCF80A904E15386219);
// https://etherscan.io/address/0xd8B153FaAA8f2b1bC774916FEd333A4F3dE48792
IAaveOracle internal constant ETHERFI_ESPOKE_ORACLE =
IAaveOracle(0xd8B153FaAA8f2b1bC774916FEd333A4F3dE48792);
// https://etherscan.io/address/0x3131FE68C4722e726fe6B2819ED68e514395B9a4
ISpoke internal constant KELP_ESPOKE = ISpoke(0x3131FE68C4722e726fe6B2819ED68e514395B9a4);
// https://etherscan.io/address/0x37C316996C714Bf906743071e04E62220b3271ac
IAaveOracle internal constant KELP_ESPOKE_ORACLE =
IAaveOracle(0x37C316996C714Bf906743071e04E62220b3271ac);
// https://etherscan.io/address/0xe1900480ac69f0B296841Cd01cC37546d92F35Cd
ISpoke internal constant LIDO_ESPOKE = ISpoke(0xe1900480ac69f0B296841Cd01cC37546d92F35Cd);
// https://etherscan.io/address/0x664D73b6C3591333Fd79510f7ce9ef81228824F5
IAaveOracle internal constant LIDO_ESPOKE_ORACLE =
IAaveOracle(0x664D73b6C3591333Fd79510f7ce9ef81228824F5);
// https://etherscan.io/address/0x774b9655413c34809c1f1b16b654465A89EBE989
ISpoke internal constant USDG_MAPLE_ESPOKE = ISpoke(0x774b9655413c34809c1f1b16b654465A89EBE989);
// https://etherscan.io/address/0x47a7cC7Fd47aCed15087a8b6e0ACFddCD63C811A
IAaveOracle internal constant USDG_MAPLE_ESPOKE_ORACLE =
IAaveOracle(0x47a7cC7Fd47aCed15087a8b6e0ACFddCD63C811A);
}
library AaveV4EthereumSpokePriceFeeds {
// https://etherscan.io/address/0x5424384B256154046E9667dDFaaa5e550145215e
address internal constant BLUECHIP_SPOKE_WETH_PRICE_FEED =
0x5424384B256154046E9667dDFaaa5e550145215e;
// https://etherscan.io/address/0xDaa4B74C6bAc4e25188e64ebc68DB5050b690cAc
address internal constant BLUECHIP_SPOKE_WBTC_PRICE_FEED =
0xDaa4B74C6bAc4e25188e64ebc68DB5050b690cAc;
// https://etherscan.io/address/0xb41E773f507F7a7EA890b1afB7d2b660c30C8B0A
address internal constant BLUECHIP_SPOKE_cbBTC_PRICE_FEED =
0xb41E773f507F7a7EA890b1afB7d2b660c30C8B0A;
// https://etherscan.io/address/0xe1D97bF61901B075E9626c8A2340a7De385861Ef
address internal constant BLUECHIP_SPOKE_wstETH_PRICE_FEED =
0xe1D97bF61901B075E9626c8A2340a7De385861Ef;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant BLUECHIP_SPOKE_PRIME_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant BLUECHIP_SPOKE_PRIME_USDT_PRICE_FEED =
0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0xD110cac5d8682A3b045D5524a9903E031d70FCCd
address internal constant BLUECHIP_SPOKE_GHO_PRICE_FEED =
0xD110cac5d8682A3b045D5524a9903E031d70FCCd;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant BLUECHIP_SPOKE_CORE_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD
address internal constant BLUECHIP_SPOKE_frxUSD_PRICE_FEED =
0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD;
// https://etherscan.io/address/0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3
address internal constant BLUECHIP_SPOKE_EURC_PRICE_FEED =
0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant BLUECHIP_SPOKE_CORE_USDT_PRICE_FEED =
0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant BLUECHIP_SPOKE_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x0a72df02CE3E4185b6CEDf561f0AE651E9BeE235
address internal constant ETHENA_CORRELATED_SPOKE_PT_USDe_7MAY2026_PRICE_FEED =
0x0a72df02CE3E4185b6CEDf561f0AE651E9BeE235;
// https://etherscan.io/address/0xa0dc0249c32fa79e8B9b17c735908a60b1141B40
address internal constant ETHENA_CORRELATED_SPOKE_PT_sUSDE_7MAY2026_PRICE_FEED =
0xa0dc0249c32fa79e8B9b17c735908a60b1141B40;
// https://etherscan.io/address/0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec
address internal constant ETHENA_CORRELATED_SPOKE_sUSDe_PRICE_FEED =
0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec;
// https://etherscan.io/address/0xC26D4a1c46d884cfF6dE9800B6aE7A8Cf48B4Ff8
address internal constant ETHENA_CORRELATED_SPOKE_USDe_PRICE_FEED =
0xC26D4a1c46d884cfF6dE9800B6aE7A8Cf48B4Ff8;
// https://etherscan.io/address/0x0a72df02CE3E4185b6CEDf561f0AE651E9BeE235
address internal constant ETHENA_ECOSYSTEM_SPOKE_PT_USDe_7MAY2026_PRICE_FEED =
0x0a72df02CE3E4185b6CEDf561f0AE651E9BeE235;
// https://etherscan.io/address/0xa0dc0249c32fa79e8B9b17c735908a60b1141B40
address internal constant ETHENA_ECOSYSTEM_SPOKE_PT_sUSDE_7MAY2026_PRICE_FEED =
0xa0dc0249c32fa79e8B9b17c735908a60b1141B40;
// https://etherscan.io/address/0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec
address internal constant ETHENA_ECOSYSTEM_SPOKE_sUSDe_PRICE_FEED =
0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec;
// https://etherscan.io/address/0xC26D4a1c46d884cfF6dE9800B6aE7A8Cf48B4Ff8
address internal constant ETHENA_ECOSYSTEM_SPOKE_USDe_PRICE_FEED =
0xC26D4a1c46d884cfF6dE9800B6aE7A8Cf48B4Ff8;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant ETHENA_ECOSYSTEM_SPOKE_PLUS_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant ETHENA_ECOSYSTEM_SPOKE_PLUS_USDT_PRICE_FEED =
0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0xD110cac5d8682A3b045D5524a9903E031d70FCCd
address internal constant ETHENA_ECOSYSTEM_SPOKE_GHO_PRICE_FEED =
0xD110cac5d8682A3b045D5524a9903E031d70FCCd;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant ETHENA_ECOSYSTEM_SPOKE_CORE_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD
address internal constant ETHENA_ECOSYSTEM_SPOKE_frxUSD_PRICE_FEED =
0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant ETHENA_ECOSYSTEM_SPOKE_CORE_USDT_PRICE_FEED =
0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3
address internal constant FOREX_SPOKE_EURC_PRICE_FEED =
0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant FOREX_SPOKE_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant FOREX_SPOKE_USDT_PRICE_FEED =
0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0xf0eaC18E908B34770FDEe46d069c846bDa866759
address internal constant FOREX_SPOKE_RLUSD_PRICE_FEED =
0xf0eaC18E908B34770FDEe46d069c846bDa866759;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant FOREX_SPOKE_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD
address internal constant FOREX_SPOKE_frxUSD_PRICE_FEED =
0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD;
// https://etherscan.io/address/0xD110cac5d8682A3b045D5524a9903E031d70FCCd
address internal constant FOREX_SPOKE_GHO_PRICE_FEED = 0xD110cac5d8682A3b045D5524a9903E031d70FCCd;
// https://etherscan.io/address/0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6
address internal constant GOLD_SPOKE_XAUt_PRICE_FEED = 0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant GOLD_SPOKE_USDC_PRICE_FEED = 0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0xf0eaC18E908B34770FDEe46d069c846bDa866759
address internal constant GOLD_SPOKE_RLUSD_PRICE_FEED =
0xf0eaC18E908B34770FDEe46d069c846bDa866759;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant GOLD_SPOKE_USDG_PRICE_FEED = 0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD
address internal constant GOLD_SPOKE_frxUSD_PRICE_FEED =
0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD;
// https://etherscan.io/address/0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3
address internal constant GOLD_SPOKE_EURC_PRICE_FEED = 0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3;
// https://etherscan.io/address/0xD110cac5d8682A3b045D5524a9903E031d70FCCd
address internal constant GOLD_SPOKE_GHO_PRICE_FEED = 0xD110cac5d8682A3b045D5524a9903E031d70FCCd;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant GOLD_SPOKE_USDT_PRICE_FEED = 0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0xf8c04B50499872A5B5137219DEc0F791f7f620D0
address internal constant LOMBARD_BTC_SPOKE_LBTC_PRICE_FEED =
0xf8c04B50499872A5B5137219DEc0F791f7f620D0;
// https://etherscan.io/address/0xDaa4B74C6bAc4e25188e64ebc68DB5050b690cAc
address internal constant LOMBARD_BTC_SPOKE_WBTC_PRICE_FEED =
0xDaa4B74C6bAc4e25188e64ebc68DB5050b690cAc;
// https://etherscan.io/address/0xb41E773f507F7a7EA890b1afB7d2b660c30C8B0A
address internal constant LOMBARD_BTC_SPOKE_cbBTC_PRICE_FEED =
0xb41E773f507F7a7EA890b1afB7d2b660c30C8B0A;
// https://etherscan.io/address/0x5424384B256154046E9667dDFaaa5e550145215e
address internal constant MAIN_SPOKE_WETH_PRICE_FEED = 0x5424384B256154046E9667dDFaaa5e550145215e;
// https://etherscan.io/address/0xe1D97bF61901B075E9626c8A2340a7De385861Ef
address internal constant MAIN_SPOKE_wstETH_PRICE_FEED =
0xe1D97bF61901B075E9626c8A2340a7De385861Ef;
// https://etherscan.io/address/0x87625393534d5C102cADB66D37201dF24cc26d4C
address internal constant MAIN_SPOKE_weETH_PRICE_FEED =
0x87625393534d5C102cADB66D37201dF24cc26d4C;
// https://etherscan.io/address/0xDaa4B74C6bAc4e25188e64ebc68DB5050b690cAc
address internal constant MAIN_SPOKE_WBTC_PRICE_FEED = 0xDaa4B74C6bAc4e25188e64ebc68DB5050b690cAc;
// https://etherscan.io/address/0xb41E773f507F7a7EA890b1afB7d2b660c30C8B0A
address internal constant MAIN_SPOKE_cbBTC_PRICE_FEED =
0xb41E773f507F7a7EA890b1afB7d2b660c30C8B0A;
// https://etherscan.io/address/0xF02C1e2A3B77c1cacC72f72B44f7d0a4c62e4a85
address internal constant MAIN_SPOKE_AAVE_PRICE_FEED = 0xF02C1e2A3B77c1cacC72f72B44f7d0a4c62e4a85;
// https://etherscan.io/address/0xC7e9b623ed51F033b32AE7f1282b1AD62C28C183
address internal constant MAIN_SPOKE_LINK_PRICE_FEED = 0xC7e9b623ed51F033b32AE7f1282b1AD62C28C183;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant MAIN_SPOKE_USDC_PRICE_FEED = 0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant MAIN_SPOKE_USDT_PRICE_FEED = 0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3
address internal constant MAIN_SPOKE_EURC_PRICE_FEED = 0xa6aB031A4d189B24628EC9Eb155F0a0f1A0E55a3;
// https://etherscan.io/address/0xf0eaC18E908B34770FDEe46d069c846bDa866759
address internal constant MAIN_SPOKE_RLUSD_PRICE_FEED =
0xf0eaC18E908B34770FDEe46d069c846bDa866759;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant MAIN_SPOKE_USDG_PRICE_FEED = 0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD
address internal constant MAIN_SPOKE_frxUSD_PRICE_FEED =
0x25DEd2f9aE6ae9416693AB63Abe3aB25493861FD;
// https://etherscan.io/address/0xD110cac5d8682A3b045D5524a9903E031d70FCCd
address internal constant MAIN_SPOKE_GHO_PRICE_FEED = 0xD110cac5d8682A3b045D5524a9903E031d70FCCd;
// https://etherscan.io/address/0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6
address internal constant PAXG_GOLD_SPOKE_PAXG_PRICE_FEED =
0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant PAXG_GOLD_SPOKE_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x89F6Eb404AbF19FE817426dD2E2E0F14D1a5712e
address internal constant USDG_PENDLE_SPOKE_PT_USDG_24SEP2026_PRICE_FEED =
0x89F6Eb404AbF19FE817426dD2E2E0F14D1a5712e;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant USDG_PENDLE_SPOKE_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x260326c220E469358846b187eE53328303Efe19C
address internal constant USDG_PENDLE_SPOKE_USDT_PRICE_FEED =
0x260326c220E469358846b187eE53328303Efe19C;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant USDG_PENDLE_SPOKE_CORE_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant USDG_PENDLE_SPOKE_GLOBAL_DOLLAR_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x87625393534d5C102cADB66D37201dF24cc26d4C
address internal constant ETHERFI_ESPOKE_weETH_PRICE_FEED =
0x87625393534d5C102cADB66D37201dF24cc26d4C;
// https://etherscan.io/address/0x5424384B256154046E9667dDFaaa5e550145215e
address internal constant ETHERFI_ESPOKE_WETH_PRICE_FEED =
0x5424384B256154046E9667dDFaaa5e550145215e;
// https://etherscan.io/address/0x7292C95A5f6A501a9c4B34f6393e221F2A0139c3
address internal constant KELP_ESPOKE_rsETH_PRICE_FEED =
0x7292C95A5f6A501a9c4B34f6393e221F2A0139c3;
// https://etherscan.io/address/0x5424384B256154046E9667dDFaaa5e550145215e
address internal constant KELP_ESPOKE_WETH_PRICE_FEED =
0x5424384B256154046E9667dDFaaa5e550145215e;
// https://etherscan.io/address/0xe1D97bF61901B075E9626c8A2340a7De385861Ef
address internal constant LIDO_ESPOKE_wstETH_PRICE_FEED =
0xe1D97bF61901B075E9626c8A2340a7De385861Ef;
// https://etherscan.io/address/0x5424384B256154046E9667dDFaaa5e550145215e
address internal constant LIDO_ESPOKE_WETH_PRICE_FEED =
0x5424384B256154046E9667dDFaaa5e550145215e;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant USDG_MAPLE_ESPOKE_GLOBAL_DOLLAR_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
// https://etherscan.io/address/0x5A6FcB0ebc018b6FD94Fc5f5A9F0948d0D40f040
address internal constant USDG_MAPLE_ESPOKE_syrupUSDG_PRICE_FEED =
0x5A6FcB0ebc018b6FD94Fc5f5A9F0948d0D40f040;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant USDG_MAPLE_ESPOKE_USDC_PRICE_FEED =
0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4
address internal constant USDG_MAPLE_ESPOKE_CORE_USDG_PRICE_FEED =
0x83D20dEEdcd4aC1313496c8CBcAad0fa298c0CE4;
}
library AaveV4EthereumTokenizationSpokes {
// https://etherscan.io/address/0x7320CF22Ac095bA2a2e0a652F77efB836c2E751b
ITokenizationSpoke internal constant CORE_WETH_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x7320CF22Ac095bA2a2e0a652F77efB836c2E751b);
// https://etherscan.io/address/0xcb0E7dA9c635628f6d4827355AeCa75aB8d3560f
ITokenizationSpoke internal constant CORE_wstETH_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xcb0E7dA9c635628f6d4827355AeCa75aB8d3560f);
// https://etherscan.io/address/0x559cEc2C840D9DBB18936Afc5E5341D78bfC7Cbe
ITokenizationSpoke internal constant CORE_weETH_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x559cEc2C840D9DBB18936Afc5E5341D78bfC7Cbe);
// https://etherscan.io/address/0x45a04Ca1A5cbEeA4B44356c75EDd29b33eB2527a
ITokenizationSpoke internal constant CORE_rsETH_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x45a04Ca1A5cbEeA4B44356c75EDd29b33eB2527a);
// https://etherscan.io/address/0x5eC44a70F309854fe04d495cFE1B5dA63DD1cc73
ITokenizationSpoke internal constant CORE_USDT_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x5eC44a70F309854fe04d495cFE1B5dA63DD1cc73);
// https://etherscan.io/address/0x531E90a2376902DE8915789Fcc1075e3B0c153E7
ITokenizationSpoke internal constant CORE_USDC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x531E90a2376902DE8915789Fcc1075e3B0c153E7);
// https://etherscan.io/address/0x58C14a5E061c9bC6926c5b853445290F296C2F7B
ITokenizationSpoke internal constant CORE_GHO_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x58C14a5E061c9bC6926c5b853445290F296C2F7B);
// https://etherscan.io/address/0xC8a125AE4275a78AADc53B46Ca10566Bc9B249E0
ITokenizationSpoke internal constant CORE_RLUSD_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xC8a125AE4275a78AADc53B46Ca10566Bc9B249E0);
// https://etherscan.io/address/0xAC2435E3C25e8246870D33ce0a26988A46d5DB68
ITokenizationSpoke internal constant CORE_USDG_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xAC2435E3C25e8246870D33ce0a26988A46d5DB68);
// https://etherscan.io/address/0x2226749630775ee20230Ad65214fB339087eF30D
ITokenizationSpoke internal constant CORE_frxUSD_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x2226749630775ee20230Ad65214fB339087eF30D);
// https://etherscan.io/address/0x6D9e2Cdd61CaF69af99b275704B6e272C41c6718
ITokenizationSpoke internal constant CORE_EURC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x6D9e2Cdd61CaF69af99b275704B6e272C41c6718);
// https://etherscan.io/address/0x82A9CC4656784E55Ef2E78F704028B5E1Bfc1732
ITokenizationSpoke internal constant CORE_WBTC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x82A9CC4656784E55Ef2E78F704028B5E1Bfc1732);
// https://etherscan.io/address/0x33B41B74366F55327d959FfF6D6b6fBc2853dbB1
ITokenizationSpoke internal constant CORE_cbBTC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x33B41B74366F55327d959FfF6D6b6fBc2853dbB1);
// https://etherscan.io/address/0x7961F140B570490849DB878AE222570ea838799d
ITokenizationSpoke internal constant CORE_LBTC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x7961F140B570490849DB878AE222570ea838799d);
// https://etherscan.io/address/0x4E712562fcb5337011398B6C630f55b60641cd5e
ITokenizationSpoke internal constant CORE_XAUt_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x4E712562fcb5337011398B6C630f55b60641cd5e);
// https://etherscan.io/address/0x0A65197b16C5969F92672051c9C9C0C75B369135
ITokenizationSpoke internal constant CORE_AAVE_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x0A65197b16C5969F92672051c9C9C0C75B369135);
// https://etherscan.io/address/0xE69C2045095C8Ab3E2a7d77de2328faE5baF797c
ITokenizationSpoke internal constant CORE_LINK_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xE69C2045095C8Ab3E2a7d77de2328faE5baF797c);
// https://etherscan.io/address/0x90774889c22D2F2Adf44da1f04C7c95542590df4
ITokenizationSpoke internal constant PLUS_PT_sUSDE_7MAY2026_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x90774889c22D2F2Adf44da1f04C7c95542590df4);
// https://etherscan.io/address/0xdd2Eb78BF9e6aC5068B95aD2d451e8c9Af10ac81
ITokenizationSpoke internal constant PLUS_PT_USDe_7MAY2026_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xdd2Eb78BF9e6aC5068B95aD2d451e8c9Af10ac81);
// https://etherscan.io/address/0x24f8c062e1E0451736C1D6E023510DA262a41df4
ITokenizationSpoke internal constant PLUS_sUSDe_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x24f8c062e1E0451736C1D6E023510DA262a41df4);
// https://etherscan.io/address/0x502Cd81da6a8F1785eb2eEE72713B7388E16A854
ITokenizationSpoke internal constant PLUS_USDe_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x502Cd81da6a8F1785eb2eEE72713B7388E16A854);
// https://etherscan.io/address/0xc94bdd83D2c7655C280655D60954e79E88D4F949
ITokenizationSpoke internal constant PLUS_USDC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xc94bdd83D2c7655C280655D60954e79E88D4F949);
// https://etherscan.io/address/0xA54382db40EC602c0a173A08f9E86Ed40F9D4D10
ITokenizationSpoke internal constant PLUS_GHO_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xA54382db40EC602c0a173A08f9E86Ed40F9D4D10);
// https://etherscan.io/address/0x80835EB50694EE0e519743f67e5401e6FD300006
ITokenizationSpoke internal constant PLUS_USDT_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x80835EB50694EE0e519743f67e5401e6FD300006);
// https://etherscan.io/address/0x2087513383330B961A3753B47627Bbf149F31c70
ITokenizationSpoke internal constant PRIME_WETH_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x2087513383330B961A3753B47627Bbf149F31c70);
// https://etherscan.io/address/0x5AE3d87De89CA6Ce501e8317887F71EABED69E18
ITokenizationSpoke internal constant PRIME_WBTC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x5AE3d87De89CA6Ce501e8317887F71EABED69E18);
// https://etherscan.io/address/0xD38098faf52D8E915EdED84fBF30F81C17906938
ITokenizationSpoke internal constant PRIME_cbBTC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xD38098faf52D8E915EdED84fBF30F81C17906938);
// https://etherscan.io/address/0xFCD3D3C69cd032DE0cc78fE529B7447D2fe7F666
ITokenizationSpoke internal constant PRIME_wstETH_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xFCD3D3C69cd032DE0cc78fE529B7447D2fe7F666);
// https://etherscan.io/address/0x486415fb1F8b062c89ED548f871cf64304AACb31
ITokenizationSpoke internal constant PRIME_USDC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x486415fb1F8b062c89ED548f871cf64304AACb31);
// https://etherscan.io/address/0x46c588DD8453aC259c1f6a54b4C9A93C2aC3762D
ITokenizationSpoke internal constant PRIME_USDT_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x46c588DD8453aC259c1f6a54b4C9A93C2aC3762D);
// https://etherscan.io/address/0x900fD46d565d1ac8995928c0179052ec02a6D0E1
ITokenizationSpoke internal constant PRIME_GHO_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x900fD46d565d1ac8995928c0179052ec02a6D0E1);
// https://etherscan.io/address/0x7Df10B4A01350D2A1d95cFbE7c9207d7210A2663
ITokenizationSpoke internal constant GLOBAL_DOLLAR_PT_USDG_24SEP2026_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x7Df10B4A01350D2A1d95cFbE7c9207d7210A2663);
// https://etherscan.io/address/0xaed7c529bD2878170B61C758DfAa215AC7a4FD07
ITokenizationSpoke internal constant GLOBAL_DOLLAR_USDC_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xaed7c529bD2878170B61C758DfAa215AC7a4FD07);
// https://etherscan.io/address/0xa0e97e45C2f89003730E467Bd484fA3eEcE5B4Cf
ITokenizationSpoke internal constant GLOBAL_DOLLAR_USDT_TOKENIZATION_SPOKE =
ITokenizationSpoke(0xa0e97e45C2f89003730E467Bd484fA3eEcE5B4Cf);
// https://etherscan.io/address/0x378B4a7c394E22bd562F66eB612165893533c124
ITokenizationSpoke internal constant GLOBAL_DOLLAR_USDG_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x378B4a7c394E22bd562F66eB612165893533c124);
// https://etherscan.io/address/0x6493a23874b506D5Bb6038ea44aE9CC74cD00849
ITokenizationSpoke internal constant GLOBAL_DOLLAR_PAXG_TOKENIZATION_SPOKE =
ITokenizationSpoke(0x6493a23874b506D5Bb6038ea44aE9CC74cD00849);
}
library AaveV4EthereumIRStrategies {
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_WETH_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_wstETH_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_weETH_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_rsETH_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_USDT_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_USDC_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_GHO_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_RLUSD_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_USDG_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_frxUSD_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_EURC_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_WBTC_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_cbBTC_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_LBTC_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_XAUt_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_AAVE_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f
IBasicInterestRateStrategy internal constant CORE_LINK_IR_STRATEGY =
IBasicInterestRateStrategy(0xAD88791B0F81D1FA242f637eB05bee0cbc53fe2f);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_PT_sUSDE_7MAY2026_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_PT_USDe_7MAY2026_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_sUSDe_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_USDe_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_USDC_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_GHO_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0x31280650661b8443723fa9739b3A164E3696af48
IBasicInterestRateStrategy internal constant PLUS_USDT_IR_STRATEGY =
IBasicInterestRateStrategy(0x31280650661b8443723fa9739b3A164E3696af48);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_WETH_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_WBTC_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_cbBTC_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_wstETH_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_USDC_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_USDT_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D
IBasicInterestRateStrategy internal constant PRIME_GHO_IR_STRATEGY =
IBasicInterestRateStrategy(0xDCd924047a4bDBFef9CCDDe845E5D45373Ad276D);
// https://etherscan.io/address/0xD7eC225DC053151100A0ef47b94a77AAD9C413b7
IBasicInterestRateStrategy internal constant GLOBAL_DOLLAR_PT_USDG_24SEP2026_IR_STRATEGY =
IBasicInterestRateStrategy(0xD7eC225DC053151100A0ef47b94a77AAD9C413b7);
// https://etherscan.io/address/0xD7eC225DC053151100A0ef47b94a77AAD9C413b7
IBasicInterestRateStrategy internal constant GLOBAL_DOLLAR_USDC_IR_STRATEGY =
IBasicInterestRateStrategy(0xD7eC225DC053151100A0ef47b94a77AAD9C413b7);
// https://etherscan.io/address/0xD7eC225DC053151100A0ef47b94a77AAD9C413b7
IBasicInterestRateStrategy internal constant GLOBAL_DOLLAR_USDT_IR_STRATEGY =
IBasicInterestRateStrategy(0xD7eC225DC053151100A0ef47b94a77AAD9C413b7);
// https://etherscan.io/address/0xD7eC225DC053151100A0ef47b94a77AAD9C413b7
IBasicInterestRateStrategy internal constant GLOBAL_DOLLAR_USDG_IR_STRATEGY =
IBasicInterestRateStrategy(0xD7eC225DC053151100A0ef47b94a77AAD9C413b7);
// https://etherscan.io/address/0xD7eC225DC053151100A0ef47b94a77AAD9C413b7
IBasicInterestRateStrategy internal constant GLOBAL_DOLLAR_syrupUSDG_IR_STRATEGY =
IBasicInterestRateStrategy(0xD7eC225DC053151100A0ef47b94a77AAD9C413b7);
// https://etherscan.io/address/0xD7eC225DC053151100A0ef47b94a77AAD9C413b7
IBasicInterestRateStrategy internal constant GLOBAL_DOLLAR_PAXG_IR_STRATEGY =
IBasicInterestRateStrategy(0xD7eC225DC053151100A0ef47b94a77AAD9C413b7);
}
library AaveV4EthereumPositionManagers {
// https://etherscan.io/address/0x17A54b8d6D9C68e7fa1C7112AC998EA1BA51d11e
IGiverPositionManager internal constant GIVER_POSITION_MANAGER =
IGiverPositionManager(0x17A54b8d6D9C68e7fa1C7112AC998EA1BA51d11e);
// https://etherscan.io/address/0x6c044c0D3801499bCAbfAd458B70880bc518e9F7
ITakerPositionManager internal constant TAKER_POSITION_MANAGER =
ITakerPositionManager(0x6c044c0D3801499bCAbfAd458B70880bc518e9F7);
// https://etherscan.io/address/0x51305839CE822a7b4b12AA7D86eA7005052d575c
IConfigPositionManager internal constant CONFIG_POSITION_MANAGER =
IConfigPositionManager(0x51305839CE822a7b4b12AA7D86eA7005052d575c);
// https://etherscan.io/address/0xe68ab4F90Fe026B9873F5F276eD2d7efBbbE42Be
INativeTokenGateway internal constant NATIVE_TOKEN_GATEWAY =
INativeTokenGateway(0xe68ab4F90Fe026B9873F5F276eD2d7efBbbE42Be);
// https://etherscan.io/address/0xfbC184337Dc6595D8bf62968Bda46e7De7AF9c3d
ISignatureGateway internal constant SIGNATURE_GATEWAY =
ISignatureGateway(0xfbC184337Dc6595D8bf62968Bda46e7De7AF9c3d);
}
library AaveV4EthereumExternalLibraries {
// https://etherscan.io/address/0x88dF535473C5adf1f57789734A05E555F7Deb8DB
address internal constant LIQUIDATION_LOGIC = 0x88dF535473C5adf1f57789734A05E555F7Deb8DB;
}
library AaveV4EthereumAssets {
// https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
address internal constant WETH_UNDERLYING = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
uint8 internal constant WETH_DECIMALS = 18;
// https://etherscan.io/address/0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0
address internal constant wstETH_UNDERLYING = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;
uint8 internal constant wstETH_DECIMALS = 18;
// https://etherscan.io/address/0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee
address internal constant weETH_UNDERLYING = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee;
uint8 internal constant weETH_DECIMALS = 18;
// https://etherscan.io/address/0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7
address internal constant rsETH_UNDERLYING = 0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7;
uint8 internal constant rsETH_DECIMALS = 18;
// https://etherscan.io/address/0xdAC17F958D2ee523a2206206994597C13D831ec7
address internal constant USDT_UNDERLYING = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
uint8 internal constant USDT_DECIMALS = 6;
// https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
address internal constant USDC_UNDERLYING = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
uint8 internal constant USDC_DECIMALS = 6;
// https://etherscan.io/address/0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f
address internal constant GHO_UNDERLYING = 0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f;
uint8 internal constant GHO_DECIMALS = 18;
// https://etherscan.io/address/0x8292Bb45bf1Ee4d140127049757C2E0fF06317eD
address internal constant RLUSD_UNDERLYING = 0x8292Bb45bf1Ee4d140127049757C2E0fF06317eD;
uint8 internal constant RLUSD_DECIMALS = 18;
// https://etherscan.io/address/0xe343167631d89B6Ffc58B88d6b7fB0228795491D
address internal constant USDG_UNDERLYING = 0xe343167631d89B6Ffc58B88d6b7fB0228795491D;
uint8 internal constant USDG_DECIMALS = 6;
// https://etherscan.io/address/0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29
address internal constant frxUSD_UNDERLYING = 0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29;
uint8 internal constant frxUSD_DECIMALS = 18;
// https://etherscan.io/address/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c
address internal constant EURC_UNDERLYING = 0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c;
uint8 internal constant EURC_DECIMALS = 6;
// https://etherscan.io/address/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
address internal constant WBTC_UNDERLYING = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
uint8 internal constant WBTC_DECIMALS = 8;
// https://etherscan.io/address/0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf
address internal constant cbBTC_UNDERLYING = 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf;
uint8 internal constant cbBTC_DECIMALS = 8;
// https://etherscan.io/address/0x8236a87084f8B84306f72007F36F2618A5634494
address internal constant LBTC_UNDERLYING = 0x8236a87084f8B84306f72007F36F2618A5634494;
uint8 internal constant LBTC_DECIMALS = 8;
// https://etherscan.io/address/0x68749665FF8D2d112Fa859AA293F07A622782F38
address internal constant XAUt_UNDERLYING = 0x68749665FF8D2d112Fa859AA293F07A622782F38;
uint8 internal constant XAUt_DECIMALS = 6;
// https://etherscan.io/address/0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9
address internal constant AAVE_UNDERLYING = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9;
uint8 internal constant AAVE_DECIMALS = 18;
// https://etherscan.io/address/0x514910771AF9Ca656af840dff83E8264EcF986CA
address internal constant LINK_UNDERLYING = 0x514910771AF9Ca656af840dff83E8264EcF986CA;
uint8 internal constant LINK_DECIMALS = 18;
// https://etherscan.io/address/0x3de0ff76E8b528C092d47b9DaC775931cef80F49
address internal constant PT_sUSDE_7MAY2026_UNDERLYING =
0x3de0ff76E8b528C092d47b9DaC775931cef80F49;
uint8 internal constant PT_sUSDE_7MAY2026_DECIMALS = 18;
// https://etherscan.io/address/0xAeBf0Bb9f57E89260d57f31AF34eB58657d96Ce0
address internal constant PT_USDe_7MAY2026_UNDERLYING =
0xAeBf0Bb9f57E89260d57f31AF34eB58657d96Ce0;
uint8 internal constant PT_USDe_7MAY2026_DECIMALS = 18;
// https://etherscan.io/address/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497
address internal constant sUSDe_UNDERLYING = 0x9D39A5DE30e57443BfF2A8307A4256c8797A3497;
uint8 internal constant sUSDe_DECIMALS = 18;
// https://etherscan.io/address/0x4c9EDD5852cd905f086C759E8383e09bff1E68B3
address internal constant USDe_UNDERLYING = 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3;
uint8 internal constant USDe_DECIMALS = 18;
// https://etherscan.io/address/0xc1906aeCf868749a2DeE203F59b904c0cf212140
address internal constant PT_USDG_24SEP2026_UNDERLYING =
0xc1906aeCf868749a2DeE203F59b904c0cf212140;
uint8 internal constant PT_USDG_24SEP2026_DECIMALS = 6;
// https://etherscan.io/address/0x87b65C4aAFFA76881f9E96F3e7ED945ddFC3Cd7A
address internal constant syrupUSDG_UNDERLYING = 0x87b65C4aAFFA76881f9E96F3e7ED945ddFC3Cd7A;
uint8 internal constant syrupUSDG_DECIMALS = 6;
// https://etherscan.io/address/0x45804880De22913dAFE09f4980848ECE6EcbAf78
address internal constant PAXG_UNDERLYING = 0x45804880De22913dAFE09f4980848ECE6EcbAf78;
uint8 internal constant PAXG_DECIMALS = 18;
}
library AaveV4EthereumGetters {
function getAllHubs() internal pure returns (IHub[] memory) {
IHub[] memory hubs = new IHub[](4);
hubs[0] = AaveV4EthereumHubs.CORE_HUB;
hubs[1] = AaveV4EthereumHubs.PLUS_HUB;
hubs[2] = AaveV4EthereumHubs.PRIME_HUB;
hubs[3] = AaveV4EthereumHubs.GLOBAL_DOLLAR_HUB;
return hubs;
}
function getAllSpokes() internal pure returns (ISpoke[] memory) {
ISpoke[] memory spokes = new ISpoke[](13);
spokes[0] = AaveV4EthereumSpokes.BLUECHIP_SPOKE;
spokes[1] = AaveV4EthereumSpokes.ETHENA_CORRELATED_SPOKE;
spokes[2] = AaveV4EthereumSpokes.ETHENA_ECOSYSTEM_SPOKE;
spokes[3] = AaveV4EthereumSpokes.FOREX_SPOKE;
spokes[4] = AaveV4EthereumSpokes.GOLD_SPOKE;
spokes[5] = AaveV4EthereumSpokes.LOMBARD_BTC_SPOKE;
spokes[6] = AaveV4EthereumSpokes.MAIN_SPOKE;
spokes[7] = AaveV4EthereumSpokes.PAXG_GOLD_SPOKE;
spokes[8] = AaveV4EthereumSpokes.USDG_PENDLE_SPOKE;
spokes[9] = AaveV4EthereumSpokes.ETHERFI_ESPOKE;
spokes[10] = AaveV4EthereumSpokes.KELP_ESPOKE;
spokes[11] = AaveV4EthereumSpokes.LIDO_ESPOKE;
spokes[12] = AaveV4EthereumSpokes.USDG_MAPLE_ESPOKE;
return spokes;
}
function getAllTokenizationSpokes() internal pure returns (ITokenizationSpoke[] memory) {
ITokenizationSpoke[] memory tokenizedSpokes = new ITokenizationSpoke[](36);
tokenizedSpokes[0] = AaveV4EthereumTokenizationSpokes.CORE_WETH_TOKENIZATION_SPOKE;
tokenizedSpokes[1] = AaveV4EthereumTokenizationSpokes.CORE_wstETH_TOKENIZATION_SPOKE;
tokenizedSpokes[2] = AaveV4EthereumTokenizationSpokes.CORE_weETH_TOKENIZATION_SPOKE;
tokenizedSpokes[3] = AaveV4EthereumTokenizationSpokes.CORE_rsETH_TOKENIZATION_SPOKE;
tokenizedSpokes[4] = AaveV4EthereumTokenizationSpokes.CORE_USDT_TOKENIZATION_SPOKE;
tokenizedSpokes[5] = AaveV4EthereumTokenizationSpokes.CORE_USDC_TOKENIZATION_SPOKE;
tokenizedSpokes[6] = AaveV4EthereumTokenizationSpokes.CORE_GHO_TOKENIZATION_SPOKE;
tokenizedSpokes[7] = AaveV4EthereumTokenizationSpokes.CORE_RLUSD_TOKENIZATION_SPOKE;
tokenizedSpokes[8] = AaveV4EthereumTokenizationSpokes.CORE_USDG_TOKENIZATION_SPOKE;
tokenizedSpokes[9] = AaveV4EthereumTokenizationSpokes.CORE_frxUSD_TOKENIZATION_SPOKE;
tokenizedSpokes[10] = AaveV4EthereumTokenizationSpokes.CORE_EURC_TOKENIZATION_SPOKE;
tokenizedSpokes[11] = AaveV4EthereumTokenizationSpokes.CORE_WBTC_TOKENIZATION_SPOKE;
tokenizedSpokes[12] = AaveV4EthereumTokenizationSpokes.CORE_cbBTC_TOKENIZATION_SPOKE;
tokenizedSpokes[13] = AaveV4EthereumTokenizationSpokes.CORE_LBTC_TOKENIZATION_SPOKE;
tokenizedSpokes[14] = AaveV4EthereumTokenizationSpokes.CORE_XAUt_TOKENIZATION_SPOKE;
tokenizedSpokes[15] = AaveV4EthereumTokenizationSpokes.CORE_AAVE_TOKENIZATION_SPOKE;
tokenizedSpokes[16] = AaveV4EthereumTokenizationSpokes.CORE_LINK_TOKENIZATION_SPOKE;
tokenizedSpokes[17] = AaveV4EthereumTokenizationSpokes
.PLUS_PT_sUSDE_7MAY2026_TOKENIZATION_SPOKE;
tokenizedSpokes[18] = AaveV4EthereumTokenizationSpokes.PLUS_PT_USDe_7MAY2026_TOKENIZATION_SPOKE;
tokenizedSpokes[19] = AaveV4EthereumTokenizationSpokes.PLUS_sUSDe_TOKENIZATION_SPOKE;
tokenizedSpokes[20] = AaveV4EthereumTokenizationSpokes.PLUS_USDe_TOKENIZATION_SPOKE;
tokenizedSpokes[21] = AaveV4EthereumTokenizationSpokes.PLUS_USDC_TOKENIZATION_SPOKE;
tokenizedSpokes[22] = AaveV4EthereumTokenizationSpokes.PLUS_GHO_TOKENIZATION_SPOKE;
tokenizedSpokes[23] = AaveV4EthereumTokenizationSpokes.PLUS_USDT_TOKENIZATION_SPOKE;
tokenizedSpokes[24] = AaveV4EthereumTokenizationSpokes.PRIME_WETH_TOKENIZATION_SPOKE;
tokenizedSpokes[25] = AaveV4EthereumTokenizationSpokes.PRIME_WBTC_TOKENIZATION_SPOKE;
tokenizedSpokes[26] = AaveV4EthereumTokenizationSpokes.PRIME_cbBTC_TOKENIZATION_SPOKE;
tokenizedSpokes[27] = AaveV4EthereumTokenizationSpokes.PRIME_wstETH_TOKENIZATION_SPOKE;
tokenizedSpokes[28] = AaveV4EthereumTokenizationSpokes.PRIME_USDC_TOKENIZATION_SPOKE;
tokenizedSpokes[29] = AaveV4EthereumTokenizationSpokes.PRIME_USDT_TOKENIZATION_SPOKE;
tokenizedSpokes[30] = AaveV4EthereumTokenizationSpokes.PRIME_GHO_TOKENIZATION_SPOKE;
tokenizedSpokes[31] = AaveV4EthereumTokenizationSpokes
.GLOBAL_DOLLAR_PT_USDG_24SEP2026_TOKENIZATION_SPOKE;
tokenizedSpokes[32] = AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_USDC_TOKENIZATION_SPOKE;
tokenizedSpokes[33] = AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_USDT_TOKENIZATION_SPOKE;
tokenizedSpokes[34] = AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_USDG_TOKENIZATION_SPOKE;
tokenizedSpokes[35] = AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_PAXG_TOKENIZATION_SPOKE;
return tokenizedSpokes;
}
function getAllSpokesRaw() internal pure returns (address[] memory) {
address[] memory spokes = new address[](50);
spokes[0] = address(AaveV4EthereumSpokes.TREASURY_SPOKE);
spokes[1] = address(AaveV4EthereumSpokes.BLUECHIP_SPOKE);
spokes[2] = address(AaveV4EthereumSpokes.ETHENA_CORRELATED_SPOKE);
spokes[3] = address(AaveV4EthereumSpokes.ETHENA_ECOSYSTEM_SPOKE);
spokes[4] = address(AaveV4EthereumSpokes.FOREX_SPOKE);
spokes[5] = address(AaveV4EthereumSpokes.GOLD_SPOKE);
spokes[6] = address(AaveV4EthereumSpokes.LOMBARD_BTC_SPOKE);
spokes[7] = address(AaveV4EthereumSpokes.MAIN_SPOKE);
spokes[8] = address(AaveV4EthereumSpokes.PAXG_GOLD_SPOKE);
spokes[9] = address(AaveV4EthereumSpokes.USDG_PENDLE_SPOKE);
spokes[10] = address(AaveV4EthereumSpokes.ETHERFI_ESPOKE);
spokes[11] = address(AaveV4EthereumSpokes.KELP_ESPOKE);
spokes[12] = address(AaveV4EthereumSpokes.LIDO_ESPOKE);
spokes[13] = address(AaveV4EthereumSpokes.USDG_MAPLE_ESPOKE);
spokes[14] = address(AaveV4EthereumTokenizationSpokes.CORE_WETH_TOKENIZATION_SPOKE);
spokes[15] = address(AaveV4EthereumTokenizationSpokes.CORE_wstETH_TOKENIZATION_SPOKE);
spokes[16] = address(AaveV4EthereumTokenizationSpokes.CORE_weETH_TOKENIZATION_SPOKE);
spokes[17] = address(AaveV4EthereumTokenizationSpokes.CORE_rsETH_TOKENIZATION_SPOKE);
spokes[18] = address(AaveV4EthereumTokenizationSpokes.CORE_USDT_TOKENIZATION_SPOKE);
spokes[19] = address(AaveV4EthereumTokenizationSpokes.CORE_USDC_TOKENIZATION_SPOKE);
spokes[20] = address(AaveV4EthereumTokenizationSpokes.CORE_GHO_TOKENIZATION_SPOKE);
spokes[21] = address(AaveV4EthereumTokenizationSpokes.CORE_RLUSD_TOKENIZATION_SPOKE);
spokes[22] = address(AaveV4EthereumTokenizationSpokes.CORE_USDG_TOKENIZATION_SPOKE);
spokes[23] = address(AaveV4EthereumTokenizationSpokes.CORE_frxUSD_TOKENIZATION_SPOKE);
spokes[24] = address(AaveV4EthereumTokenizationSpokes.CORE_EURC_TOKENIZATION_SPOKE);
spokes[25] = address(AaveV4EthereumTokenizationSpokes.CORE_WBTC_TOKENIZATION_SPOKE);
spokes[26] = address(AaveV4EthereumTokenizationSpokes.CORE_cbBTC_TOKENIZATION_SPOKE);
spokes[27] = address(AaveV4EthereumTokenizationSpokes.CORE_LBTC_TOKENIZATION_SPOKE);
spokes[28] = address(AaveV4EthereumTokenizationSpokes.CORE_XAUt_TOKENIZATION_SPOKE);
spokes[29] = address(AaveV4EthereumTokenizationSpokes.CORE_AAVE_TOKENIZATION_SPOKE);
spokes[30] = address(AaveV4EthereumTokenizationSpokes.CORE_LINK_TOKENIZATION_SPOKE);
spokes[31] = address(
AaveV4EthereumTokenizationSpokes.PLUS_PT_sUSDE_7MAY2026_TOKENIZATION_SPOKE
);
spokes[32] = address(AaveV4EthereumTokenizationSpokes.PLUS_PT_USDe_7MAY2026_TOKENIZATION_SPOKE);
spokes[33] = address(AaveV4EthereumTokenizationSpokes.PLUS_sUSDe_TOKENIZATION_SPOKE);
spokes[34] = address(AaveV4EthereumTokenizationSpokes.PLUS_USDe_TOKENIZATION_SPOKE);
spokes[35] = address(AaveV4EthereumTokenizationSpokes.PLUS_USDC_TOKENIZATION_SPOKE);
spokes[36] = address(AaveV4EthereumTokenizationSpokes.PLUS_GHO_TOKENIZATION_SPOKE);
spokes[37] = address(AaveV4EthereumTokenizationSpokes.PLUS_USDT_TOKENIZATION_SPOKE);
spokes[38] = address(AaveV4EthereumTokenizationSpokes.PRIME_WETH_TOKENIZATION_SPOKE);
spokes[39] = address(AaveV4EthereumTokenizationSpokes.PRIME_WBTC_TOKENIZATION_SPOKE);
spokes[40] = address(AaveV4EthereumTokenizationSpokes.PRIME_cbBTC_TOKENIZATION_SPOKE);
spokes[41] = address(AaveV4EthereumTokenizationSpokes.PRIME_wstETH_TOKENIZATION_SPOKE);
spokes[42] = address(AaveV4EthereumTokenizationSpokes.PRIME_USDC_TOKENIZATION_SPOKE);
spokes[43] = address(AaveV4EthereumTokenizationSpokes.PRIME_USDT_TOKENIZATION_SPOKE);
spokes[44] = address(AaveV4EthereumTokenizationSpokes.PRIME_GHO_TOKENIZATION_SPOKE);
spokes[45] = address(
AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_PT_USDG_24SEP2026_TOKENIZATION_SPOKE
);
spokes[46] = address(AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_USDC_TOKENIZATION_SPOKE);
spokes[47] = address(AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_USDT_TOKENIZATION_SPOKE);
spokes[48] = address(AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_USDG_TOKENIZATION_SPOKE);
spokes[49] = address(AaveV4EthereumTokenizationSpokes.GLOBAL_DOLLAR_PAXG_TOKENIZATION_SPOKE);
return spokes;
}
function getPositionManagers() internal pure returns (PositionManagers memory) {
return
PositionManagers({
giver: AaveV4EthereumPositionManagers.GIVER_POSITION_MANAGER,
taker: AaveV4EthereumPositionManagers.TAKER_POSITION_MANAGER,
config: AaveV4EthereumPositionManagers.CONFIG_POSITION_MANAGER,
nativeGateway: AaveV4EthereumPositionManagers.NATIVE_TOKEN_GATEWAY,
signatureGateway: AaveV4EthereumPositionManagers.SIGNATURE_GATEWAY
});
}
}
lib/aave-helpers/src/v4-config-engine/AaveV4PayloadEthereum.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AaveV4Ethereum} from 'aave-address-book/AaveV4Ethereum.sol';
import {AaveV4Payload} from 'aave-v4/config-engine/AaveV4Payload.sol';
/**
* @dev Base smart contract for an Aave V4 governance payload on Ethereum.
* @author Aave Labs
*/
abstract contract AaveV4PayloadEthereum is AaveV4Payload(AaveV4Ethereum.CONFIG_ENGINE) {}
lib/aave-helpers/src/v4-config-engine/V4EngineDefaults.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IAaveV4ConfigEngine} from 'aave-address-book/AaveV4.sol';
import {IAssetInterestRateStrategy} from 'aave-v4/hub/interfaces/IAssetInterestRateStrategy.sol';
/// @title V4EngineDefaults
/// @notice Conventional presets for Aave V4 config engine listing inputs.
/// @author Aave Labs
library V4EngineDefaults {
/// @notice Highest optimal usage ratio an asset interest rate strategy accepts, in BPS.
/// @dev Mirrors `AssetInterestRateStrategy.MAX_OPTIMAL_RATIO`, not importable as a constant.
uint16 internal constant MAX_OPTIMAL_USAGE_RATIO = 99_00;
/// @notice Interest rate data for an asset listed as collateral only, holding the drawn rate at 0.
/// @dev The optimal ratio cannot be 0: the strategy only accepts it within
/// [`MIN_OPTIMAL_RATIO`, `MAX_OPTIMAL_RATIO`], and a flat curve makes the value inert.
/// @return The interest rate data to pass as `AssetListing.irData`.
function nonBorrowableIRData()
internal
pure
returns (IAssetInterestRateStrategy.InterestRateData memory)
{
return
IAssetInterestRateStrategy.InterestRateData({
optimalUsageRatio: MAX_OPTIMAL_USAGE_RATIO,
baseDrawnRate: 0,
rateGrowthBeforeOptimal: 0,
rateGrowthAfterOptimal: 0
});
}
/// @notice Tokenization config listing an asset on a hub without an ERC4626 wrapper.
/// @dev The engine skips the deployment only when every field is unset; a partial config reverts.
/// @return The tokenization config to pass as `AssetListing.tokenization`.
function noTokenization()
internal
pure
returns (IAaveV4ConfigEngine.TokenizationSpokeConfig memory)
{
return
IAaveV4ConfigEngine.TokenizationSpokeConfig({
addCap: 0,
proxyAdminOwner: address(0),
name: '',
symbol: ''
});
}
}
lib/aave-helpers/src/v4-config-engine/V4RoleWiring.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IAaveV4ConfigEngine} from 'aave-address-book/AaveV4.sol';
import {Roles} from 'aave-v4/deployments/utils/libraries/Roles.sol';
/// @title V4RoleWiring
/// @notice Builds the AccessManager role updates a freshly deployed Hub or Spoke needs, since a new
/// entity ships with its restricted selectors ungated on the shared AccessManager.
/// @author Aave Labs
library V4RoleWiring {
/// @notice Role updates gating a new Hub's restricted selectors.
/// @param authority The AccessManager governing the hub.
/// @param hub The hub to wire.
/// @return The three role updates to pass to `accessManagerTargetFunctionRoleUpdates`.
function hubWiring(
address authority,
address hub
) internal pure returns (IAaveV4ConfigEngine.TargetFunctionRoleUpdate[] memory) {
IAaveV4ConfigEngine.TargetFunctionRoleUpdate[]
memory updates = new IAaveV4ConfigEngine.TargetFunctionRoleUpdate[](3);
updates[0] = IAaveV4ConfigEngine.TargetFunctionRoleUpdate({
authority: authority,
target: hub,
selectors: Roles.getHubConfiguratorRoleSelectors(),
roleId: Roles.HUB_CONFIGURATOR_ROLE
});
updates[1] = IAaveV4ConfigEngine.TargetFunctionRoleUpdate({
authority: authority,
target: hub,
selectors: Roles.getHubFeeMinterRoleSelectors(),
roleId: Roles.HUB_FEE_MINTER_ROLE
});
updates[2] = IAaveV4ConfigEngine.TargetFunctionRoleUpdate({
authority: authority,
target: hub,
selectors: Roles.getHubDeficitEliminatorRoleSelectors(),
roleId: Roles.HUB_DEFICIT_ELIMINATOR_ROLE
});
return updates;
}
/// @notice Role updates gating a new Spoke's restricted selectors.
/// @param authority The AccessManager governing the spoke.
/// @param spoke The spoke to wire.
/// @return The two role updates to pass to `accessManagerTargetFunctionRoleUpdates`.
function spokeWiring(
address authority,
address spoke
) internal pure returns (IAaveV4ConfigEngine.TargetFunctionRoleUpdate[] memory) {
IAaveV4ConfigEngine.TargetFunctionRoleUpdate[]
memory updates = new IAaveV4ConfigEngine.TargetFunctionRoleUpdate[](2);
updates[0] = IAaveV4ConfigEngine.TargetFunctionRoleUpdate({
authority: authority,
target: spoke,
selectors: Roles.getSpokeConfiguratorRoleSelectors(),
roleId: Roles.SPOKE_CONFIGURATOR_ROLE
});
updates[1] = IAaveV4ConfigEngine.TargetFunctionRoleUpdate({
authority: authority,
target: spoke,
selectors: Roles.getSpokePositionUpdaterRoleSelectors(),
roleId: Roles.SPOKE_USER_POSITION_UPDATER_ROLE
});
return updates;
}
/// @notice Concatenate two role update arrays into the single array the engine consumes.
/// @param a The updates to place first.
/// @param b The updates to append.
/// @return The concatenation of `a` and `b`.
function merge(
IAaveV4ConfigEngine.TargetFunctionRoleUpdate[] memory a,
IAaveV4ConfigEngine.TargetFunctionRoleUpdate[] memory b
) internal pure returns (IAaveV4ConfigEngine.TargetFunctionRoleUpdate[] memory) {
IAaveV4ConfigEngine.TargetFunctionRoleUpdate[]
memory merged = new IAaveV4ConfigEngine.TargetFunctionRoleUpdate[](a.length + b.length);
uint256 index;
for (uint256 i; i < a.length; ++i) {
merged[index++] = a[i];
}
for (uint256 i; i < b.length; ++i) {
merged[index++] = b[i];
}
return merged;
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": [
"forge-std/=lib/aave-helpers/lib/forge-std/src/",
"solidity-utils/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/src/",
"aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/",
"aave-v3-origin-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/tests/",
"aave-address-book/=lib/aave-helpers/lib/aave-address-book/src/",
"aave-v4/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"openzeppelin-contracts/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"aave-helpers/=lib/aave-helpers/",
"lib/aave-helpers/:src/=lib/aave-helpers/src/",
"lib/aave-helpers/:src/=lib/aave-helpers/src/",
"aave-umbrella/=lib/aave-umbrella/src/contracts/",
"lib/aave-helpers/:aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/",
"lib/aave-helpers/:aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/",
"lib/aave-address-book/lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-umbrella/:erc4626-tests/=lib/aave-umbrella/lib/erc4626-tests/",
"lib/aave-umbrella/:erc4626-tests/=lib/aave-umbrella/lib/erc4626-tests/",
"@openzeppelin/contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/aave-umbrella/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.