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
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ additional_compiler_profiles = [
compilation_restrictions = [
{ paths = "src/hub/instances/HubInstance.sol", via_ir = true, optimizer_runs = 22_300 },
{ paths = "src/spoke/instances/SpokeInstance.sol", via_ir = true, optimizer_runs = 750 },
{ paths = "src/spoke/instances/PermissionedSpokeInstance.sol", via_ir = true, optimizer_runs = 750 },
]

[bind_json]
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy/examples/AaveV4DeployAnvil.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ contract AaveV4DeployAnvil is AaveV4DeployBatchBaseScript {
spokeConfiguratorAdmin: address(1),
gatewayOwner: address(2),
positionManagerOwner: address(3),
spokeGate: address(0),
nativeWrapper: weth,
deployNativeTokenGateway: true,
deploySignatureGateway: true,
Expand Down
6 changes: 3 additions & 3 deletions snapshots/ConfigPositionManager.Operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"setCanUpdateUserDynamicConfigPermission": "50158",
"setCanUpdateUserRiskPremiumPermission": "50158",
"setGlobalPermission": "50110",
"setUsingAsCollateralOnBehalfOf": "77828",
"updateUserDynamicConfigOnBehalfOf": "52342",
"updateUserRiskPremiumOnBehalfOf": "140135"
"setUsingAsCollateralOnBehalfOf": "81569",
"updateUserDynamicConfigOnBehalfOf": "56254",
"updateUserRiskPremiumOnBehalfOf": "143955"
}
4 changes: 2 additions & 2 deletions snapshots/GiverPositionManager.Operations.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"repayOnBehalfOf": "176497",
"supplyOnBehalfOf": "143072"
"repayOnBehalfOf": "180173",
"supplyOnBehalfOf": "146148"
}
12 changes: 6 additions & 6 deletions snapshots/NativeTokenGateway.Operations.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"borrowNative": "238707",
"repayNative": "172321",
"supplyAsCollateralNative": "165113",
"supplyNative": "139728",
"withdrawNative: full": "129898",
"withdrawNative: partial": "142172"
"borrowNative": "242424",
"repayNative": "175997",
"supplyAsCollateralNative": "170331",
"supplyNative": "142804",
"withdrawNative: full": "133022",
"withdrawNative: partial": "146077"
}
17 changes: 0 additions & 17 deletions snapshots/PermissionedSpoke.Operations.json

This file was deleted.

2 changes: 1 addition & 1 deletion snapshots/PositionManagerBase.Operations.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"setSelfAsUserPositionManagerWithSig": "75041"
"setSelfAsUserPositionManagerWithSig": "97035"
}
16 changes: 8 additions & 8 deletions snapshots/SignatureGateway.Operations.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"borrowWithSig": "222144",
"repayWithSig": "192513",
"setSelfAsUserPositionManagerWithSig": "75138",
"setUsingAsCollateralWithSig": "85380",
"supplyWithSig": "155914",
"updateUserDynamicConfigWithSig": "63113",
"updateUserRiskPremiumWithSig": "61995",
"withdrawWithSig": "135124"
"borrowWithSig": "225860",
"repayWithSig": "196189",
"setSelfAsUserPositionManagerWithSig": "97112",
"setUsingAsCollateralWithSig": "89253",
"supplyWithSig": "158990",
"updateUserDynamicConfigWithSig": "67025",
"updateUserRiskPremiumWithSig": "65875",
"withdrawWithSig": "138497"
}
17 changes: 17 additions & 0 deletions snapshots/Spoke.Gate.Operations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"borrow: borrow-allowlist policy": "302550",
"borrow: global-manager policy": "297141",
"borrow: position-manager policy": "297290",
"repay: partial, borrow-allowlist policy": "149851",
"repay: partial, global-manager policy": "149774",
"repay: partial, position-manager policy": "149923",
"supply: borrow-allowlist policy": "131268",
"supply: global-manager policy": "131191",
"supply: position-manager policy": "131340",
"usingAsCollateral: enable, borrow-allowlist policy": "63093",
"usingAsCollateral: enable, global-manager policy": "63016",
"usingAsCollateral: enable, position-manager policy": "63165",
"withdraw: partial, borrow-allowlist policy": "184831",
"withdraw: partial, global-manager policy": "184754",
"withdraw: partial, position-manager policy": "184903"
}
10 changes: 5 additions & 5 deletions snapshots/Spoke.Getters.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"getUserAccountData: supplies: 0, borrows: 0": "13014",
"getUserAccountData: supplies: 1, borrows: 0": "56072",
"getUserAccountData: supplies: 2, borrows: 0": "89894",
"getUserAccountData: supplies: 2, borrows: 1": "112389",
"getUserAccountData: supplies: 2, borrows: 2": "133792"
"getUserAccountData: supplies: 0, borrows: 0": "12860",
"getUserAccountData: supplies: 1, borrows: 0": "55918",
"getUserAccountData: supplies: 2, borrows: 0": "89740",
"getUserAccountData: supplies: 2, borrows: 1": "112187",
"getUserAccountData: supplies: 2, borrows: 2": "133590"
}
64 changes: 32 additions & 32 deletions snapshots/Spoke.Operations.ZeroRiskPremium.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"borrow: first": "199509",
"borrow: second action, same reserve": "179375",
"liquidationCall (receiveShares): full": "314227",
"liquidationCall (receiveShares): partial": "313645",
"liquidationCall (reportDeficit): full": "380307",
"liquidationCall: full": "332763",
"liquidationCall: partial": "332181",
"permitReserve + repay (multicall)": "169938",
"permitReserve + supply (multicall)": "151663",
"permitReserve + supply + enable collateral (multicall)": "166114",
"repay: full": "129276",
"repay: partial": "134234",
"setUserPositionManagersWithSig: disable": "46772",
"setUserPositionManagersWithSig: enable": "68684",
"supply + enable collateral (multicall)": "146316",
"supply: 0 borrows, collateral disabled": "127753",
"supply: 0 borrows, collateral enabled": "110724",
"supply: second action, same reserve": "110653",
"updateUserDynamicConfig: 1 collateral": "76251",
"updateUserDynamicConfig: 2 collaterals": "92825",
"updateUserRiskPremium: 1 borrow": "104446",
"updateUserRiskPremium: 2 borrows": "114563",
"usingAsCollateral: 0 borrows, enable": "59616",
"usingAsCollateral: 1 borrow, disable": "114490",
"usingAsCollateral: 1 borrow, enable": "42504",
"usingAsCollateral: 2 borrows, disable": "138182",
"usingAsCollateral: 2 borrows, enable": "42516",
"withdraw: 0 borrows, full": "135058",
"withdraw: 0 borrows, partial": "140394",
"withdraw: 1 borrow, partial": "169591",
"withdraw: 2 borrows, partial": "186292",
"withdraw: non collateral": "111299"
"borrow: first": "203221",
"borrow: second action, same reserve": "183087",
"liquidationCall (receiveShares): full": "313977",
"liquidationCall (receiveShares): partial": "313395",
"liquidationCall (reportDeficit): full": "380105",
"liquidationCall: full": "332513",
"liquidationCall: partial": "331931",
"permitReserve + repay (multicall)": "173482",
"permitReserve + supply (multicall)": "155254",
"permitReserve + supply + enable collateral (multicall)": "170993",
"repay: full": "133058",
"repay: partial": "138016",
"setUserPositionManagersWithSig: disable": "43946",
"setUserPositionManagersWithSig: enable": "82934",
"supply + enable collateral (multicall)": "151244",
"supply: 0 borrows, collateral disabled": "131594",
"supply: 0 borrows, collateral enabled": "114565",
"supply: second action, same reserve": "114494",
"updateUserDynamicConfig: 1 collateral": "80093",
"updateUserDynamicConfig: 2 collaterals": "96667",
"updateUserRiskPremium: 1 borrow": "108196",
"updateUserRiskPremium: 2 borrows": "118314",
"usingAsCollateral: 0 borrows, enable": "63419",
"usingAsCollateral: 1 borrow, disable": "118224",
"usingAsCollateral: 1 borrow, enable": "46307",
"usingAsCollateral: 2 borrows, disable": "141916",
"usingAsCollateral: 2 borrows, enable": "46319",
"withdraw: 0 borrows, full": "138950",
"withdraw: 0 borrows, partial": "144286",
"withdraw: 1 borrow, partial": "173435",
"withdraw: 2 borrows, partial": "190136",
"withdraw: non collateral": "115200"
}
64 changes: 32 additions & 32 deletions snapshots/Spoke.Operations.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"borrow: first": "269297",
"borrow: second action, same reserve": "212163",
"liquidationCall (receiveShares): full": "347124",
"liquidationCall (receiveShares): partial": "346542",
"liquidationCall (reportDeficit): full": "372507",
"liquidationCall: full": "365660",
"liquidationCall: partial": "365078",
"permitReserve + repay (multicall)": "166334",
"permitReserve + supply (multicall)": "151663",
"permitReserve + supply + enable collateral (multicall)": "166114",
"repay: full": "123355",
"repay: partial": "142713",
"setUserPositionManagersWithSig: disable": "46772",
"setUserPositionManagersWithSig: enable": "68684",
"supply + enable collateral (multicall)": "146316",
"supply: 0 borrows, collateral disabled": "127753",
"supply: 0 borrows, collateral enabled": "110724",
"supply: second action, same reserve": "110653",
"updateUserDynamicConfig: 1 collateral": "76251",
"updateUserDynamicConfig: 2 collaterals": "92825",
"updateUserRiskPremium: 1 borrow": "158658",
"updateUserRiskPremium: 2 borrows": "210210",
"usingAsCollateral: 0 borrows, enable": "59616",
"usingAsCollateral: 1 borrow, disable": "168699",
"usingAsCollateral: 1 borrow, enable": "42504",
"usingAsCollateral: 2 borrows, disable": "241825",
"usingAsCollateral: 2 borrows, enable": "42516",
"withdraw: 0 borrows, full": "135058",
"withdraw: 0 borrows, partial": "140394",
"withdraw: 1 borrow, partial": "221298",
"withdraw: 2 borrows, partial": "270470",
"withdraw: non collateral": "111299"
"borrow: first": "273010",
"borrow: second action, same reserve": "215876",
"liquidationCall (receiveShares): full": "346874",
"liquidationCall (receiveShares): partial": "346292",
"liquidationCall (reportDeficit): full": "372305",
"liquidationCall: full": "365410",
"liquidationCall: partial": "364828",
"permitReserve + repay (multicall)": "169169",
"permitReserve + supply (multicall)": "155254",
"permitReserve + supply + enable collateral (multicall)": "170993",
"repay: full": "127137",
"repay: partial": "146495",
"setUserPositionManagersWithSig: disable": "43946",
"setUserPositionManagersWithSig: enable": "82934",
"supply + enable collateral (multicall)": "151244",
"supply: 0 borrows, collateral disabled": "131594",
"supply: 0 borrows, collateral enabled": "114565",
"supply: second action, same reserve": "114494",
"updateUserDynamicConfig: 1 collateral": "80093",
"updateUserDynamicConfig: 2 collaterals": "96667",
"updateUserRiskPremium: 1 borrow": "162408",
"updateUserRiskPremium: 2 borrows": "213960",
"usingAsCollateral: 0 borrows, enable": "63419",
"usingAsCollateral: 1 borrow, disable": "172433",
"usingAsCollateral: 1 borrow, enable": "46307",
"usingAsCollateral: 2 borrows, disable": "245560",
"usingAsCollateral: 2 borrows, enable": "46319",
"withdraw: 0 borrows, full": "138950",
"withdraw: 0 borrows, partial": "144286",
"withdraw: 1 borrow, partial": "225142",
"withdraw: 2 borrows, partial": "274314",
"withdraw: non collateral": "115200"
}
6 changes: 3 additions & 3 deletions snapshots/TakerPositionManager.Operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"approveBorrowWithSig": "65689",
"approveWithdraw": "49816",
"approveWithdrawWithSig": "65643",
"borrowOnBehalfOf": "332512",
"borrowOnBehalfOf": "336008",
"renounceBorrowAllowance": "27929",
"renounceWithdrawAllowance": "27983",
"withdrawOnBehalfOf: full": "127209",
"withdrawOnBehalfOf: partial": "138811"
"withdrawOnBehalfOf: full": "130333",
"withdrawOnBehalfOf: partial": "142716"
}
6 changes: 3 additions & 3 deletions snapshots/TokenizationSpoke.Operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"deposit": "118614",
"depositWithSig": "129518",
"mint": "118251",
"mintWithSig": "129130",
"mintWithSig": "129118",
"permit": "62766",
"redeem: on behalf, full": "95212",
"redeem: on behalf, partial": "119015",
"redeem: self, full": "94282",
"redeem: self, partial": "113482",
"redeemWithSig": "128864",
"redeemWithSig": "128852",
"withdraw: on behalf, full": "95646",
"withdraw: on behalf, partial": "119557",
"withdraw: self, full": "94824",
"withdraw: self, partial": "114024",
"withdrawWithSig": "129405"
"withdrawWithSig": "129417"
}
7 changes: 6 additions & 1 deletion src/deployments/batches/AaveV4SpokeInstanceBatch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ contract AaveV4SpokeInstanceBatch is AaveV4SpokeDeployProcedure, AaveV4AaveOracl
/// @dev Constructor.
/// @param proxyAdminOwner_ The owner of the proxy admin.
/// @param authority_ The access-control authority for the Spoke.
/// @param gate_ The immutable gate for the Spoke.
/// @param spokeBytecode_ The creation bytecode of the Spoke implementation.
/// @param oracleDecimals_ The decimal precision for the AaveOracle.
/// @param maxUserReservesLimit_ The maximum number of reserves a user can interact with.
/// @param salt_ The CREATE2 salt for deterministic deployment.
constructor(
address proxyAdminOwner_,
address authority_,
address gate_,
bytes memory spokeBytecode_,
uint8 oracleDecimals_,
uint16 maxUserReservesLimit_,
Expand All @@ -33,19 +35,22 @@ contract AaveV4SpokeInstanceBatch is AaveV4SpokeDeployProcedure, AaveV4AaveOracl
proxyAdminOwner: proxyAdminOwner_,
authority: authority_,
oracle: aaveOracle,
gate: gate_,
spokeBytecode: spokeBytecode_,
salt: salt_,
maxUserReservesLimit: maxUserReservesLimit_
});
IAaveOracle(aaveOracle).setSpoke(spokeProxy);

require(ISpoke(spokeProxy).ORACLE() == aaveOracle, 'spoke oracle mismatch');
require(ISpoke(spokeProxy).GATE() == gate_, 'spoke gate mismatch');
require(IAaveOracle(aaveOracle).spoke() == spokeProxy, 'oracle spoke mismatch');

_report = BatchReports.SpokeInstanceBatchReport({
aaveOracle: aaveOracle,
spokeImplementation: spokeImplementation,
spokeProxy: spokeProxy
spokeProxy: spokeProxy,
gate: gate_
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/deployments/libraries/BatchReports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ library BatchReports {
/// @dev spokeProxy The deployed Spoke proxy contract address.
/// @dev spokeImplementation The deployed Spoke implementation contract address.
/// @dev aaveOracle The deployed AaveOracle contract address.
/// @dev gate The immutable gate used by the Spoke.
struct SpokeInstanceBatchReport {
address spokeProxy;
address spokeImplementation;
address aaveOracle;
address gate;
}

/// @dev hubProxy The deployed Hub proxy contract address.
Expand Down
2 changes: 2 additions & 0 deletions src/deployments/libraries/OrchestrationReports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ library OrchestrationReports {
/// @dev hubInstanceBatchReports Per-hub deployment reports.
/// @dev gatewaysBatchReport Gateway deployment report.
/// @dev positionManagerBatchReport PositionManager deployment report.
/// @dev spokeGate The gate shared by deployed Spokes.
/// @dev salt The salt used to derive deterministic contract addresses.
struct FullDeploymentReport {
BatchReports.AuthorityBatchReport authorityBatchReport;
Expand All @@ -37,6 +38,7 @@ library OrchestrationReports {
HubDeploymentReport[] hubInstanceBatchReports;
BatchReports.GatewaysBatchReport gatewaysBatchReport;
BatchReports.PositionManagerBatchReport positionManagerBatchReport;
address spokeGate;
bytes32 salt;
}
}
3 changes: 3 additions & 0 deletions src/deployments/orchestration/AaveV4DeployBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ library AaveV4DeployBase {
/// @notice Deploys the Spoke instance batch containing the Spoke proxy, implementation, and AaveOracle.
/// @param proxyAdminOwner The owner of the proxy admin.
/// @param authority The access-control authority for the Spoke.
/// @param gate The immutable gate for the Spoke.
/// @param spokeBytecode The creation bytecode of the SpokeInstance contract.
/// @param oracleDecimals The decimal precision for the AaveOracle.
/// @param maxUserReservesLimit The maximum number of reserves a user can interact with.
Expand All @@ -93,6 +94,7 @@ library AaveV4DeployBase {
function deploySpokeInstanceBatch(
address proxyAdminOwner,
address authority,
address gate,
bytes memory spokeBytecode,
uint8 oracleDecimals,
uint16 maxUserReservesLimit,
Expand All @@ -101,6 +103,7 @@ library AaveV4DeployBase {
AaveV4SpokeInstanceBatch spokeInstanceBatch = new AaveV4SpokeInstanceBatch({
proxyAdminOwner_: proxyAdminOwner,
authority_: authority,
gate_: gate,
spokeBytecode_: spokeBytecode,
oracleDecimals_: oracleDecimals,
maxUserReservesLimit_: maxUserReservesLimit,
Expand Down
Loading
Loading