Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"filename": "aave-core/aave-config/sources/error_config.move",
"hashed_secret": "ba29d6bfac4cd7b866a3d05103c38031a921ba88",
"is_verified": false,
"line_number": 1160
"line_number": 1176
}
],
"aave-core/aave-config/tests/error_tests.move": [
Expand Down Expand Up @@ -11151,5 +11151,5 @@
}
]
},
"generated_at": "2025-08-22T08:39:13Z"
"generated_at": "2025-09-15T10:49:44Z"
}
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ doc-acl:
cd aave-core && aptos move document \
--skip-attribute-checks \
--package-dir "aave-acl" \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-acl && \
cp aave-acl/doc/* ../my-docs/docs/aave-acl
Expand Down Expand Up @@ -291,6 +292,7 @@ doc-config:
cd aave-core && aptos move document \
--skip-attribute-checks \
--package-dir "aave-config" \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-config && \
cp aave-config/doc/* ../my-docs/docs/aave-config
Expand Down Expand Up @@ -357,6 +359,7 @@ doc-large-packages:
cd aave-core && aptos move document \
--skip-attribute-checks \
--package-dir "aave-large-packages" \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-large-packages && \
cp aave-large-packages/doc/* ../my-docs/docs/aave-large-packages
Expand Down Expand Up @@ -423,6 +426,7 @@ doc-math:
cd aave-core && aptos move document \
--skip-attribute-checks \
--package-dir "aave-math" \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-math && \
cp aave-math/doc/* ../my-docs/docs/aave-math
Expand Down Expand Up @@ -611,6 +615,7 @@ doc-mock-underlyings:
cd aave-core && aptos move document \
--skip-attribute-checks \
--package-dir "aave-mock-underlyings" \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-mock-underlyings && \
cp aave-mock-underlyings/doc/* ../my-docs/docs/aave-mock-underlyings
Expand Down Expand Up @@ -677,6 +682,7 @@ doc-oracle:
cd aave-core && aptos move document \
--skip-attribute-checks \
--package-dir "aave-oracle" \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-oracle && \
cp aave-oracle/doc/* ../my-docs/docs/aave-oracle
Expand Down Expand Up @@ -745,6 +751,7 @@ coverage-pool:
doc-pool:
cd aave-core && aptos move document \
--skip-attribute-checks \
--skip-fetch-latest-git-deps \
--named-addresses "${AAVE_NAMED_ADDRESSES}" && \
mkdir -p ../my-docs/docs/aave-pool && \
cp doc/* ../my-docs/docs/aave-pool
Expand Down
16 changes: 16 additions & 0 deletions aave-core/aave-config/sources/error_config.move
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ module aave_config::error_config {
const EINVALID_FREEZE_FLAG: u64 = 99;
/// @notice Below a certain threshold liquidators need to take the full position
const EMUST_NOT_LEAVE_DUST: u64 = 103;
/// @notice Invalid amount to transfer
const EINVALID_TRANSFER_AMOUNT: u64 = 104;

// Aptos has introduced a new business logic error code range from 1001 to 2000.

Expand Down Expand Up @@ -257,6 +259,8 @@ module aave_config::error_config {
const EINVALID_SNAPSHOT_TIMESTAMP: u64 = 1228;
/// The assigned custom price is above the price cap
const ECUSTOM_PRICE_ABOVE_PRICE_CAP: u64 = 1229;
/// The oracle price computation causes an overflow
const EORACLE_PRICE_OVERFLOW: u64 = 1230;

// aave_rate module error code range from 1301 to 1400.
/// @notice Account is not the rate's owner
Expand Down Expand Up @@ -507,6 +511,12 @@ module aave_config::error_config {
EINVALID_MINT_AMOUNT
}

/// @notice Returns the error code for invalid transfer amount
/// @return Error code as u64
public fun get_einvalid_transfer_amount(): u64 {
EINVALID_TRANSFER_AMOUNT
}

/// @notice Returns the error code for invalid burn amount
/// @return Error code as u64
public fun get_einvalid_burn_amount(): u64 {
Expand Down Expand Up @@ -867,6 +877,12 @@ module aave_config::error_config {
ECUSTOM_PRICE_ABOVE_PRICE_CAP
}

/// @notice Returns the error code for oracle price overflow
/// @return Error code as u64
public fun get_eoracle_price_overflow(): u64 {
EORACLE_PRICE_OVERFLOW
}

/// @notice Returns the error code for invalid optimal usage ratio
/// @return Error code as u64
public fun get_einvalid_optimal_usage_ratio(): u64 {
Expand Down
22 changes: 21 additions & 1 deletion aave-core/aave-config/tests/error_tests.move
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ module aave_config::error_tests {
get_einvalid_snapshot_delay,
get_einvalid_snapshot_ratio,
get_einvalid_snapshot_timestamp,
get_ecustom_price_above_price_cap
get_ecustom_price_above_price_cap,
get_eoracle_price_overflow,
get_einvalid_transfer_amount
};

const TEST_SUCCESS: u64 = 1;
Expand Down Expand Up @@ -359,6 +361,9 @@ module aave_config::error_tests {
/// Below a certain threshold liquidators need to take the full position
const EMUST_NOT_LEAVE_DUST: u64 = 103;

/// Invalid amount to transfer
const EINVALID_TRANSFER_AMOUNT: u64 = 104;

// Aptos has introduced a new business logic error code range from 1001 to 2000.

// aave_acl module error code range from 1001 to 1100.
Expand Down Expand Up @@ -441,6 +446,8 @@ module aave_config::error_tests {
const EINVALID_SNAPSHOT_TIMESTAMP: u64 = 1228;
/// The assigned custom price is above the price cap
const ECUSTOM_PRICE_ABOVE_PRICE_CAP: u64 = 1229;
/// The oracle price computation causes an overflow
const EORACLE_PRICE_OVERFLOW: u64 = 1230;

// aave_rate module error code range from 1301 to 1400.

Expand Down Expand Up @@ -719,6 +726,11 @@ module aave_config::error_tests {
assert!(get_einvalid_burn_amount() == EINVALID_BURN_AMOUNT, TEST_SUCCESS);
}

#[test]
fun test_get_einvalid_transfer_amount() {
assert!(get_einvalid_transfer_amount() == EINVALID_TRANSFER_AMOUNT, TEST_SUCCESS);
}

#[test]
fun test_get_einvalid_amount() {
assert!(get_einvalid_amount() == EINVALID_AMOUNT, TEST_SUCCESS);
Expand Down Expand Up @@ -1325,6 +1337,14 @@ module aave_config::error_tests {
);
}

#[test]
public fun test_eoracle_price_overflow() {
assert!(
get_eoracle_price_overflow() == EORACLE_PRICE_OVERFLOW,
TEST_SUCCESS
);
}

#[test]
public fun test_get_einvalid_ratio_timestamp() {
assert!(get_einvalid_ratio_timestamp() == EINVALID_RATIO_TIMESTAMP, TEST_SUCCESS);
Expand Down
2 changes: 1 addition & 1 deletion aave-core/aave-oracle/sources/oracle.move
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ module aave_oracle::oracle {
fun validate_oracle_price(price: u256) {
assert!(
price <= I192_MAX,
error_config::get_enegative_oracle_price()
error_config::get_eoracle_price_overflow()
);
assert!(
price > 0,
Expand Down
1 change: 1 addition & 0 deletions aave-core/sources/aave-tokens/token_base.move
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ module aave_pool::token_base {
// NOTE: in `ray_div`, while `amount` can be less precision than Ray
// precision, `index` must be expressed in Ray precision.
let amount_scaled = wad_ray_math::ray_div(amount, index);
assert!(amount_scaled != 0, error_config::get_einvalid_transfer_amount());

// update sender balance
let sender_user_state = get_user_state(sender, metadata_address);
Expand Down
11 changes: 6 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ packages:
overrides:
'@eslint/plugin-kit@<0.3.3': '>=0.3.3'
'@eslint/plugin-kit@<0.3.4': '>=0.3.4'
axios@<1.12.0: '>=1.12.0'
brace-expansion@>=1.0.0 <=1.1.11: '>=1.1.12'
brace-expansion@>=2.0.0 <=2.0.1: '>=2.0.2'
cookie@<0.7.0: '>=0.7.0'
Expand Down
Loading