Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ be triggered by a second transaction that executes the approved proposal.
./deploy.py testnet --deployer "<deployer_profile_name>" setup-configure-reserves
./deploy.py testnet --deployer "<deployer_profile_name>" setup-configure-interest-rates
./deploy.py testnet --deployer "<deployer_profile_name>" setup-configure-price-feeds

(optional if gho reserve is to be configured too)
./deploy.py testnet --deployer "<deployer_profile_name>" setup-gho-reserve
```

### Transfer Package Ownerships
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,14 @@ configure-price-feeds:
--function-id '0x${AAVE_DATA_ADDRESS}::v1_deployment::configure_price_feeds' \
--args string:$(APTOS_NETWORK)

stup-gho-reserve:
aptos multisig create-transaction \
--assume-yes \
--multisig-address ${AAVE_POOL_ADMIN_MULTISIG_ADDRESS} \
--private-key ${AAVE_POOL_ADMIN_PRIVATE_KEY} \
--function-id '0x${AAVE_DATA_ADDRESS}::v1_deployment::setup_gho_reserve' \
--args string:$(APTOS_NETWORK)

# ===================== GLOBAL COMMANDS ===================== #

ifeq ($(APTOS_NETWORK), local)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module aave_config::is_using_as_collateral_tests {
j = j + 1;
};

i = i + 1;
i += 1;
};

assert!(failed == 0, SUCCESS);
Expand Down
159 changes: 144 additions & 15 deletions aave-core/aave-data/sources/v1.move
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module aave_data::v1 {
use std::string::{String, utf8};
use std::vector;
use aptos_std::smart_table;
use std::option::Option;
use std::option::{Self, Option};
// locals
use aave_config::error_config;

Expand Down Expand Up @@ -194,11 +194,20 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

/// @notice Gets the price feed for a specific asset on testnet
public fun get_price_feeds_testnet_for_asset(asset: String): Option<vector<u8>> acquires Data {
let table = &borrow_global<Data>(@aave_data).price_feeds_testnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the price feeds for mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, price feed addresses)
public fun get_price_feeds_mainnet_normalized(): (vector<String>, vector<vector<u8>>) acquires Data {
Expand All @@ -211,11 +220,19 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_price_feeds_mainnet_for_asset(asset: String): Option<vector<u8>> acquires Data {
let table = &borrow_global<Data>(@aave_data).price_feeds_mainnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the underlying assets for testnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, underlying asset addresses)
public fun get_underlying_assets_testnet_normalized(): (vector<String>, vector<address>) acquires Data {
Expand All @@ -228,11 +245,19 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_underlying_for_asset_testnet(asset: String): Option<address> acquires Data {
let table = &borrow_global<Data>(@aave_data).underlying_assets_testnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the underlying assets for mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, underlying asset addresses)
public fun get_underlying_assets_mainnet_normalized(): (vector<String>, vector<address>) acquires Data {
Expand All @@ -245,11 +270,19 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_underlying_for_asset_mainnet(asset: String): Option<address> acquires Data {
let table = &borrow_global<Data>(@aave_data).underlying_assets_mainnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the reserve configurations for testnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, reserve configurations)
public fun get_reserves_config_testnet_normalized(): (
Expand All @@ -264,11 +297,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_reserves_config_for_asset_testnet(
asset: String
): Option<aave_data::v1_values::ReserveConfig> acquires Data {
let table = &borrow_global<Data>(@aave_data).reserves_config_testnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the reserve configurations for mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, reserve configurations)
public fun get_reserves_config_mainnet_normalized(): (
Expand All @@ -283,11 +326,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_reserves_config_for_asset_mainnet(
asset: String
): Option<aave_data::v1_values::ReserveConfig> acquires Data {
let table = &borrow_global<Data>(@aave_data).reserves_config_mainnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the interest rate strategies for testnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, interest rate strategies)
public fun get_interest_rate_strategy_testnet_normalized(): (
Expand All @@ -302,11 +355,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_interest_rate_strategy_for_asset_testnet(
asset: String
): Option<aave_data::v1_values::InterestRateStrategy> acquires Data {
let table = &borrow_global<Data>(@aave_data).interest_rate_strategy_testnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the interest rate strategies for mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, interest rate strategies)
public fun get_interest_rate_strategy_mainnet_normalized(): (
Expand All @@ -321,11 +384,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_interest_rate_strategy_for_asset_mainnet(
asset: String
): Option<aave_data::v1_values::InterestRateStrategy> acquires Data {
let table = &borrow_global<Data>(@aave_data).interest_rate_strategy_mainnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the E-modes for mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (E-mode IDs, E-mode configurations)
public fun get_emodes_mainnet_normalized(): (
Expand All @@ -340,11 +413,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let config = *smart_table::borrow(emodes, key);
vector::push_back(&mut configs, config);
i = i + 1;
i += 1;
};
(keys, configs)
}

public fun get_emodes_for_asset_mainnet(
emode: u256
): Option<aave_data::v1_values::EmodeConfig> acquires Data {
let table = &borrow_global<Data>(@aave_data).emodes_mainnet;
if (!smart_table::contains(table, emode)) {
return option::none();
};
option::some(*smart_table::borrow(table, emode))
}

/// @notice Gets the E-modes for testnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (E-mode IDs, E-mode configurations)
public fun get_emode_testnet_normalized(): (
Expand All @@ -359,11 +442,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let config = *smart_table::borrow(emodes, key);
vector::push_back(&mut configs, config);
i = i + 1;
i += 1;
};
(keys, configs)
}

public fun get_emodes_for_asset_testnet(
emode: u256
): Option<aave_data::v1_values::EmodeConfig> acquires Data {
let table = &borrow_global<Data>(@aave_data).emodes_testnet;
if (!smart_table::contains(table, emode)) {
return option::none();
};
option::some(*smart_table::borrow(table, emode))
}

/// @notice Gets the asset max price ages for testnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset name, max_price_age)
public fun get_asset_max_price_ages_testnet_normalized(): (vector<String>, vector<u64>) acquires Data {
Expand All @@ -377,11 +470,19 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let config = *smart_table::borrow(asset_max_price_age, key);
vector::push_back(&mut asset_max_price_ages, config);
i = i + 1;
i += 1;
};
(keys, asset_max_price_ages)
}

public fun get_asset_max_price_ages_for_asset_testnet(asset: String): Option<u64> acquires Data {
let table = &borrow_global<Data>(@aave_data).asset_max_price_age_testnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the asset max price ages for mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset name, max_price_age)
public fun get_asset_max_price_ages_mainnet_normalized(): (vector<String>, vector<u64>) acquires Data {
Expand All @@ -395,11 +496,19 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let config = *smart_table::borrow(asset_max_price_age, key);
vector::push_back(&mut asset_max_price_ages, config);
i = i + 1;
i += 1;
};
(keys, asset_max_price_ages)
}

public fun get_asset_max_price_ages_for_asset_mainnet(asset: String): Option<u64> acquires Data {
let table = &borrow_global<Data>(@aave_data).asset_max_price_age_mainnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
option::some(*smart_table::borrow(table, asset))
}

/// @notice Gets the oracle configs for the assets on testnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, asset oracle configs)
public fun get_oracle_configs_testnet_normalized(): (
Expand All @@ -414,11 +523,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_oracle_configs_for_asset_testnet(
asset: String
): Option<aave_data::v1_values::CappedAssetData> acquires Data {
let table = &borrow_global<Data>(@aave_data).oracle_configs_testnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
*smart_table::borrow(table, asset)
}

/// @notice Gets the oracle configs for the assets on mainnet in normalized format (keys and values as separate vectors)
/// @return Tuple of (asset symbols, asset oracle configs)
public fun get_oracle_configs_mainnet_normalized(): (
Expand All @@ -433,11 +552,21 @@ module aave_data::v1 {
let key = *vector::borrow(&keys, i);
let val = *smart_table::borrow(table, key);
vector::push_back(&mut views, val);
i = i + 1;
i += 1;
};
(keys, views)
}

public fun get_oracle_configs_for_asset_mainnet(
asset: String
): Option<aave_data::v1_values::CappedAssetData> acquires Data {
let table = &borrow_global<Data>(@aave_data).oracle_configs_mainnet;
if (!smart_table::contains(table, asset)) {
return option::none();
};
*smart_table::borrow(table, asset)
}

/// @notice Gets all acl accounts for testnet
/// @return Tuple of addresses vectors
public fun get_acl_accounts_testnet(): (
Expand Down
Loading
Loading