Skip to content

Commit 1a7014e

Browse files
merge in dev
2 parents 77e6457 + 3644423 commit 1a7014e

File tree

12 files changed

+180
-65
lines changed

12 files changed

+180
-65
lines changed

snapshots/NativeTokenGateway.Operations.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"borrowNative": "227773",
3-
"repayNative": "159457",
4-
"supplyAsCollateralNative": "153705",
2+
"borrowNative": "227817",
3+
"repayNative": "159479",
4+
"supplyAsCollateralNative": "153727",
55
"supplyNative": "123490",
66
"withdrawNative: full": "125353",
77
"withdrawNative: partial": "136491"
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"borrowWithSig": "212987",
3-
"repayWithSig": "174148",
2+
"borrowWithSig": "213031",
3+
"repayWithSig": "174170",
44
"setSelfAsUserPositionManagerWithSig": "75433",
5-
"setUsingAsCollateralWithSig": "85407",
5+
"setUsingAsCollateralWithSig": "85429",
66
"supplyWithSig": "133393",
7-
"updateUserDynamicConfigWithSig": "63156",
8-
"updateUserRiskPremiumWithSig": "62138",
7+
"updateUserDynamicConfigWithSig": "63178",
8+
"updateUserRiskPremiumWithSig": "62160",
99
"withdrawWithSig": "130636"
1010
}

snapshots/Spoke.Getters.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"getUserAccountData: supplies: 0, borrows: 0": "12974",
3-
"getUserAccountData: supplies: 1, borrows: 0": "49275",
4-
"getUserAccountData: supplies: 2, borrows: 0": "80862",
5-
"getUserAccountData: supplies: 2, borrows: 1": "100285",
6-
"getUserAccountData: supplies: 2, borrows: 2": "119054"
2+
"getUserAccountData: supplies: 0, borrows: 0": "13018",
3+
"getUserAccountData: supplies: 1, borrows: 0": "49319",
4+
"getUserAccountData: supplies: 2, borrows: 0": "80906",
5+
"getUserAccountData: supplies: 2, borrows: 1": "100329",
6+
"getUserAccountData: supplies: 2, borrows: 2": "119098"
77
}

snapshots/Spoke.Operations.ZeroRiskPremium.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
2-
"borrow: first": "189327",
3-
"borrow: second action, same reserve": "169276",
4-
"liquidationCall (receiveShares): full": "295050",
5-
"liquidationCall (receiveShares): partial": "294768",
6-
"liquidationCall: full": "304335",
7-
"liquidationCall: partial": "304053",
8-
"permitReserve + repay (multicall)": "164415",
9-
"permitReserve + supply (multicall)": "146686",
10-
"permitReserve + supply + enable collateral (multicall)": "161133",
11-
"repay: full": "123730",
12-
"repay: partial": "128700",
2+
"borrow: first": "189371",
3+
"borrow: second action, same reserve": "169320",
4+
"liquidationCall (receiveShares): full": "295094",
5+
"liquidationCall (receiveShares): partial": "294812",
6+
"liquidationCall: full": "304379",
7+
"liquidationCall: partial": "304097",
8+
"permitReserve + repay (multicall)": "164502",
9+
"permitReserve + supply (multicall)": "146751",
10+
"permitReserve + supply + enable collateral (multicall)": "161220",
11+
"repay: full": "123774",
12+
"repay: partial": "128744",
1313
"repaySkimmed: full": "107382",
1414
"repaySkimmed: partial": "112352",
1515
"setUserPositionManagersWithSig: disable": "47351",
1616
"setUserPositionManagersWithSig: enable": "69263",
17-
"supply + enable collateral (multicall)": "141313",
18-
"supply: 0 borrows, collateral disabled": "122765",
19-
"supply: 0 borrows, collateral enabled": "105736",
20-
"supply: second action, same reserve": "105665",
17+
"supply + enable collateral (multicall)": "141400",
18+
"supply: 0 borrows, collateral disabled": "122787",
19+
"supply: 0 borrows, collateral enabled": "105758",
20+
"supply: second action, same reserve": "105687",
2121
"supplySkimmed: 0 borrows, collateral disabled": "106802",
2222
"supplySkimmed: 0 borrows, collateral enabled": "89739",
2323
"supplySkimmed: second action, same reserve": "89702",
24-
"updateUserDynamicConfig: 1 collateral": "74594",
25-
"updateUserDynamicConfig: 2 collaterals": "89511",
26-
"updateUserRiskPremium: 1 borrow": "94839",
27-
"updateUserRiskPremium: 2 borrows": "103974",
28-
"usingAsCollateral: 0 borrows, enable": "59600",
29-
"usingAsCollateral: 1 borrow, disable": "104954",
30-
"usingAsCollateral: 1 borrow, enable": "42488",
31-
"usingAsCollateral: 2 borrows, disable": "126062",
32-
"usingAsCollateral: 2 borrows, enable": "42500",
24+
"updateUserDynamicConfig: 1 collateral": "74616",
25+
"updateUserDynamicConfig: 2 collaterals": "89533",
26+
"updateUserRiskPremium: 1 borrow": "94861",
27+
"updateUserRiskPremium: 2 borrows": "103996",
28+
"usingAsCollateral: 0 borrows, enable": "59622",
29+
"usingAsCollateral: 1 borrow, disable": "104976",
30+
"usingAsCollateral: 1 borrow, enable": "42510",
31+
"usingAsCollateral: 2 borrows, disable": "126084",
32+
"usingAsCollateral: 2 borrows, enable": "42522",
3333
"withdraw: 0 borrows, full": "127683",
3434
"withdraw: 0 borrows, partial": "132369",
3535
"withdraw: 1 borrow, partial": "158763",

snapshots/Spoke.Operations.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
2-
"borrow: first": "258259",
3-
"borrow: second action, same reserve": "201208",
4-
"liquidationCall (receiveShares): full": "327087",
5-
"liquidationCall (receiveShares): partial": "326805",
6-
"liquidationCall: full": "336372",
7-
"liquidationCall: partial": "336090",
8-
"permitReserve + repay (multicall)": "161916",
9-
"permitReserve + supply (multicall)": "146686",
10-
"permitReserve + supply + enable collateral (multicall)": "161133",
11-
"repay: full": "117809",
12-
"repay: partial": "137179",
2+
"borrow: first": "258303",
3+
"borrow: second action, same reserve": "201252",
4+
"liquidationCall (receiveShares): full": "327131",
5+
"liquidationCall (receiveShares): partial": "326849",
6+
"liquidationCall: full": "336416",
7+
"liquidationCall: partial": "336134",
8+
"permitReserve + repay (multicall)": "161985",
9+
"permitReserve + supply (multicall)": "146751",
10+
"permitReserve + supply + enable collateral (multicall)": "161220",
11+
"repay: full": "117853",
12+
"repay: partial": "137223",
1313
"repaySkimmed: full": "101461",
1414
"repaySkimmed: partial": "120831",
1515
"setUserPositionManagersWithSig: disable": "47351",
1616
"setUserPositionManagersWithSig: enable": "69263",
17-
"supply + enable collateral (multicall)": "141313",
18-
"supply: 0 borrows, collateral disabled": "122765",
19-
"supply: 0 borrows, collateral enabled": "105736",
20-
"supply: second action, same reserve": "105665",
17+
"supply + enable collateral (multicall)": "141400",
18+
"supply: 0 borrows, collateral disabled": "122787",
19+
"supply: 0 borrows, collateral enabled": "105758",
20+
"supply: second action, same reserve": "105687",
2121
"supplySkimmed: 0 borrows, collateral disabled": "106802",
2222
"supplySkimmed: 0 borrows, collateral enabled": "89739",
2323
"supplySkimmed: second action, same reserve": "89702",
24-
"updateUserDynamicConfig: 1 collateral": "74594",
25-
"updateUserDynamicConfig: 2 collaterals": "89511",
26-
"updateUserRiskPremium: 1 borrow": "148192",
27-
"updateUserRiskPremium: 2 borrows": "197917",
28-
"usingAsCollateral: 0 borrows, enable": "59600",
29-
"usingAsCollateral: 1 borrow, disable": "158307",
30-
"usingAsCollateral: 1 borrow, enable": "42488",
31-
"usingAsCollateral: 2 borrows, disable": "228005",
32-
"usingAsCollateral: 2 borrows, enable": "42500",
24+
"updateUserDynamicConfig: 1 collateral": "74616",
25+
"updateUserDynamicConfig: 2 collaterals": "89533",
26+
"updateUserRiskPremium: 1 borrow": "148214",
27+
"updateUserRiskPremium: 2 borrows": "197939",
28+
"usingAsCollateral: 0 borrows, enable": "59622",
29+
"usingAsCollateral: 1 borrow, disable": "158329",
30+
"usingAsCollateral: 1 borrow, enable": "42510",
31+
"usingAsCollateral: 2 borrows, disable": "228027",
32+
"usingAsCollateral: 2 borrows, enable": "42522",
3333
"withdraw: 0 borrows, full": "127683",
3434
"withdraw: 0 borrows, partial": "132369",
3535
"withdraw: 1 borrow, partial": "209614",

src/interfaces/IExtSload.sol

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
// Copyright (c) 2025 Aave Labs
3+
pragma solidity ^0.8.0;
4+
5+
/// @title IExtSload
6+
/// @author Aave Labs
7+
/// @notice Minimal interface to easily access storage of source contract externally. See https://eips.ethereum.org/EIPS/eip-2330#rationale.
8+
interface IExtSload {
9+
/// @notice Returns the storage `value` of this contract at a given `slot`.
10+
/// @param slot Slot to SLOAD from.
11+
function extSload(bytes32 slot) external view returns (bytes32 value);
12+
13+
/// @notice Returns the storage `values` of this contract at the given `slots`.
14+
/// @param slots Array of slots to SLOAD from.
15+
function extSloads(bytes32[] calldata slots) external view returns (bytes32[] memory values);
16+
}

src/spoke/Spoke.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {ReserveFlags, ReserveFlagsMap} from 'src/spoke/libraries/ReserveFlagsMap
1818
import {UserPositionDebt} from 'src/spoke/libraries/UserPositionDebt.sol';
1919
import {IntentConsumer} from 'src/utils/IntentConsumer.sol';
2020
import {Multicall} from 'src/utils/Multicall.sol';
21+
import {ExtSload} from 'src/utils/ExtSload.sol';
2122
import {IAaveOracle} from 'src/spoke/interfaces/IAaveOracle.sol';
2223
import {IHubBase} from 'src/hub/interfaces/IHubBase.sol';
2324
import {ISpokeBase, ISpoke} from 'src/spoke/interfaces/ISpoke.sol';
@@ -30,6 +31,7 @@ abstract contract Spoke is
3031
ISpoke,
3132
AccessManagedUpgradeable,
3233
IntentConsumer,
34+
ExtSload,
3335
Multicall,
3436
ReentrancyGuardTransient
3537
{

src/spoke/interfaces/ISpoke.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import {IIntentConsumer} from 'src/interfaces/IIntentConsumer.sol';
77
import {IMulticall} from 'src/interfaces/IMulticall.sol';
88
import {IHubBase} from 'src/hub/interfaces/IHubBase.sol';
99
import {ISpokeBase} from 'src/spoke/interfaces/ISpokeBase.sol';
10+
import {IExtSload} from 'src/interfaces/IExtSload.sol';
1011

1112
type ReserveFlags is uint8;
1213

1314
/// @title ISpoke
1415
/// @author Aave Labs
1516
/// @notice Full interface for Spoke.
16-
interface ISpoke is ISpokeBase, IAccessManaged, IIntentConsumer, IMulticall {
17+
interface ISpoke is ISpokeBase, IAccessManaged, IIntentConsumer, IExtSload, IMulticall {
1718
/// @notice Intent data to set user position managers with EIP712-typed signature.
1819
/// @param user The address of the user on whose behalf position manager can act.
1920
/// @param updates The array of position manager updates.

src/utils/ExtSload.sol

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
// Copyright (c) 2025 Aave Labs
3+
pragma solidity ^0.8.0;
4+
5+
import {IExtSload} from 'src/interfaces/IExtSload.sol';
6+
7+
/// @title ExtSload
8+
/// @author Aave Labs
9+
/// @notice This allows the source contract to make its state available to external contracts.
10+
abstract contract ExtSload is IExtSload {
11+
/// @inheritdoc IExtSload
12+
function extSload(bytes32 slot) external view returns (bytes32 ret) {
13+
assembly ('memory-safe') {
14+
ret := sload(slot)
15+
}
16+
}
17+
18+
/// @inheritdoc IExtSload
19+
function extSloads(bytes32[] calldata slots) external view returns (bytes32[] memory) {
20+
assembly ('memory-safe') {
21+
let m := mload(0x40) // grab fmp, will not be restored since we exit context here
22+
mstore(m, 0x20) // to abi-encode response, the array will be found at the next word
23+
mstore(add(m, 0x20), slots.length) // set the length of dynamic array
24+
let start := add(m, 0x40)
25+
let end := add(start, shl(5, slots.length))
26+
for {
27+
let input := slots.offset
28+
} lt(start, end) {
29+
start := add(start, 0x20)
30+
} {
31+
mstore(start, sload(calldataload(input)))
32+
input := add(input, 0x20)
33+
}
34+
return(m, sub(end, m)) // return abi-encoded dynamic array
35+
}
36+
}
37+
}

tests/mocks/ExtSloadWrapper.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
// Copyright (c) 2025 Aave Labs
3+
pragma solidity 0.8.28;
4+
5+
import {ExtSload} from 'src/utils/ExtSload.sol';
6+
7+
contract ExtSloadWrapper is ExtSload {}

0 commit comments

Comments
 (0)