Skip to content

Commit 9350db1

Browse files
authored
Merge pull request #75 from aave/mike/test/directional-rounding
Mike/test/directional rounding
2 parents 72f33aa + ef67100 commit 9350db1

File tree

4 files changed

+3984
-0
lines changed

4 files changed

+3984
-0
lines changed

aave-core/sources/aave-logic/generic_logic.move

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,26 @@ module aave_pool::generic_logic {
229229

230230
available_borrows_in_base_currency - total_debt_in_base_currency
231231
}
232+
233+
#[test_only]
234+
/// Test helper function that exposes get_user_debt_in_base_currency for testing
235+
public fun get_user_debt_in_base_currency_for_testing(
236+
user: address,
237+
reserve_data: Object<ReserveData>,
238+
asset_price: u256,
239+
asset_unit: u256
240+
): u256 {
241+
get_user_debt_in_base_currency(user, reserve_data, asset_price, asset_unit)
242+
}
243+
244+
#[test_only]
245+
/// Test helper function that exposes get_user_balance_in_base_currency for testing
246+
public fun get_user_balance_in_base_currency_for_testing(
247+
user: address,
248+
reserve_data: Object<ReserveData>,
249+
asset_price: u256,
250+
asset_unit: u256
251+
): u256 {
252+
get_user_balance_in_base_currency(user, reserve_data, asset_price, asset_unit)
253+
}
232254
}

aave-core/sources/aave-pool/pool_logic.move

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,4 +473,22 @@ module aave_pool::pool_logic {
473473
reserve_last_update_timestamp: 0
474474
}
475475
}
476+
477+
#[test_only]
478+
/// Test helper function that exposes update_interest_rates_and_virtual_balance for testing
479+
public fun update_interest_rates_and_virtual_balance_for_testing(
480+
reserve_data: Object<ReserveData>,
481+
reserve_cache: &ReserveCache,
482+
reserve_address: address,
483+
liquidity_added: u256,
484+
liquidity_taken: u256
485+
) {
486+
update_interest_rates_and_virtual_balance(
487+
reserve_data,
488+
reserve_cache,
489+
reserve_address,
490+
liquidity_added,
491+
liquidity_taken
492+
)
493+
}
476494
}

aave-core/sources/aave-tokens/a_token_factory.move

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,4 +746,16 @@ module aave_pool::a_token_factory {
746746
public fun assert_token_exists_for_testing(metadata_address: address) acquires TokenMap {
747747
assert_token_exists(metadata_address);
748748
}
749+
750+
#[test_only]
751+
/// Test helper function that exposes transfer_on_liquidation for testing
752+
public fun transfer_on_liquidation_for_testing(
753+
from: address,
754+
to: address,
755+
amount: u256,
756+
index: u256,
757+
metadata_address: address
758+
) acquires TokenMap {
759+
transfer_on_liquidation(from, to, amount, index, metadata_address)
760+
}
749761
}

0 commit comments

Comments
 (0)