Aave V3 ACL Manager on Aptos
Aave V3 on Aptos is deprecated. Supplying and borrowing are disabled, but users can still repay debt and withdraw supplied assets. See the governance proposal.
Reference for the aave-acl Move package.
Overview
The ACL Manager implements a role-based access control system where different addresses can be assigned specific roles that grant them permissions to perform certain actions within the Aave protocol. Each role has an admin role that controls who can grant or revoke that role.
Roles
The module defines several key roles that align with the Ethereum implementation:
-
DEFAULT_: The highest-level administrative role.ADMIN_ ROLE -
POOL_: Can update token implementations, manage reserves, and more.ADMIN_ ROLE -
EMERGENCY_: Can pause/unpause the pool or individual reserves.ADMIN_ ROLE -
RISK_: Can update reserve parameters and risk settings.ADMIN_ ROLE -
FLASH_: Has premium on flash loans waived.BORROWER_ ROLE -
ASSET_: Can update oracle sources and add new assets.LISTING_ ADMIN_ ROLE -
FUNDS_: Manages funds-related operations.ADMIN_ ROLE -
EMISSION_: Manages emission-related settings.ADMIN_ ROLE -
ADMIN_: Manages ecosystem reserve funds.CONTROLLED_ ECOSYSTEM_ RESERVE_ FUNDS_ ADMIN_ ROLE -
REWARDS_: Manages reward controllers.CONTROLLER_ ADMIN_ ROLE
Write Methods
set_role_admin
public fun set_role_admin(admin: &signer, role: String, admin_role: String)
Sets a new admin role for a specific role. Only addresses with the DEFAULT_ can call this function.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the DEFAULT_ |
| role | String | The role whose admin role is being set |
| admin_role | String | The new admin role for role |
grant_role
public fun grant_role(admin: &signer, role: String, user: address)
Grants a role to an address. Can only be called by an address that has the admin role for the role being granted.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of role |
| role | String | The role to grant |
| user | address | The address receiving the role |
renounce_role
public entry fun renounce_role(admin: &signer, role: String, user: address)
Allows an address to renounce a role it has been granted. The caller must be the same as the address renouncing the role.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer renouncing the role |
| role | String | The role to renounce |
| user | address | The address renouncing the role (the signer) |
revoke_role
public fun revoke_role(admin: &signer, role: String, user: address)
Revokes a role from an address. Can only be called by an address that has the admin role for the role being revoked.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of role |
| role | String | The role to revoke |
| user | address | The address losing the role |
Pool Admin Functions
public entry fun add_pool_admin(admin: &signer, user: address)
public entry fun remove_pool_admin(admin: &signer, user: address)
These functions add and remove the POOL_. Pool admins can update token implementations, manage reserves, and perform other high-level administrative actions.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of the pool admin |
| user | address | The address to add or remove as pool admin |
Emergency Admin Functions
public entry fun add_emergency_admin(admin: &signer, user: address)
public entry fun remove_emergency_admin(admin: &signer, user: address)
These functions manage the EMERGENCY_, which allows addresses to pause and unpause the pool or individual reserves in emergency situations.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of the emergency admin |
| user | address | The address to add or remove as emergency admin |
Risk Admin Functions
public entry fun add_risk_admin(admin: &signer, user: address)
public entry fun remove_risk_admin(admin: &signer, user: address)
These functions manage the RISK_, which allows addresses to update reserve parameters, grace periods, and other risk-related settings.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of the risk admin |
| user | address | The address to add or remove as risk admin |
Flash Borrower Functions
public entry fun add_flash_borrower(admin: &signer, borrower: address)
public entry fun remove_flash_borrower(admin: &signer, borrower: address)
These functions manage the FLASH_, which allows addresses to have the premium on flash loans waived.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of the flash borrower |
| borrower | address | The address to add or remove as flash borrower |
Asset Listing Admin Functions
public entry fun add_asset_listing_admin(admin: &signer, user: address)
public entry fun remove_asset_listing_admin(admin: &signer, user: address)
These functions manage the ASSET_, which allows addresses to update oracle sources and add new assets to the Aave market.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin | &signer | The signer with the admin role of the asset listing admin |
| user | address | The address to add or remove as asset listing admin |
Additional Admin Roles
The module also includes functions for managing several other specialized roles:
- Funds Admin: Manages funds-related operations
- Emission Admin: Manages emission-related settings
- Admin Controlled Ecosystem Reserve Funds Admin: Manages ecosystem reserve funds
- Rewards Controller Admin: Manages reward controllers
View Methods
default_admin_role
#[view]
public fun default_admin_role(): String
Returns the identifier for the default admin role, which has the highest level of permissions in the system.
Return Values:
| Type | Description |
|---|---|
| String | The identifier of DEFAULT_ |
get_role_admin
#[view]
public fun get_role_admin(role: String): String
Returns the admin role that controls a specific role. By default, all roles are controlled by the DEFAULT_.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| role | String | The role to look up |
Return Values:
| Type | Description |
|---|---|
| String | The admin role of role |
has_role
#[view]
public fun has_role(role: String, user: address): bool
Checks if an address has a specific role.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| role | String | The role to check |
| user | address | The address to check |
Return Values:
| Type | Description |
|---|---|
| bool | true if user has role |
Role Checks
#[view]
public fun is_pool_admin(admin: address): bool
#[view]
public fun is_emergency_admin(admin: address): bool
#[view]
public fun is_risk_admin(admin: address): bool
#[view]
public fun is_flash_borrower(borrower: address): bool
#[view]
public fun is_asset_listing_admin(admin: address): bool
These functions check whether an address has the matching role.
Input Parameters:
| Name | Type | Description |
|---|---|---|
| admin / borrower | address | The address to check |
Return Values:
| Type | Description |
|---|---|
| bool | true if the address has the role |
Role Identifier Getters
#[view]
public fun get_pool_admin_role(): String
#[view]
public fun get_emergency_admin_role(): String
#[view]
public fun get_risk_admin_role(): String
#[view]
public fun get_flash_borrower_role(): String
#[view]
public fun get_asset_listing_admin_role(): String
#[view]
public fun get_funds_admin_role(): String
#[view]
public fun get_emission_admin_role(): String
#[view]
public fun get_admin_controlled_ecosystem_reserve_funds_admin_role(): String
#[view]
public fun get_rewards_controller_admin_role(): String
These functions return the standardized string identifier for each role, for use when interacting with the ACL Manager.
Return Values:
| Type | Description |
|---|---|
| String | The identifier of the role |
Events
The module emits events for key role management actions:
Role: Emitted when a role’s admin role is changed.Admin Changed Role: Emitted when a role is granted to an address.Granted Role: Emitted when a role is revoked from an address.Revoked
These events allow for tracking changes to the access control system over time.