Skip to content

Commit 9e8bc31

Browse files
feat: Lib introduced to avoid factory exceeding the contract size limit
1 parent f07e4e6 commit 9e8bc31

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/ATokenVaultFactory.sol

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ import {IPoolAddressesProvider} from "@aave-v3-core/interfaces/IPoolAddressesPro
88
import {TransparentUpgradeableProxy} from "@openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol";
99
import {ATokenVault} from "./ATokenVault.sol";
1010

11+
/**
12+
* @title ATokenVaultImplDeploymentLib
13+
* @author Aave Protocol
14+
* @notice Library that handles the deployment of the ATokenVault implementation contract
15+
* @dev This library is a helper to avoid holding the ATokenVault bytecode in the factory contract avoiding exceeding
16+
* the contract size limit.
17+
*/
18+
library ATokenVaultImplDeploymentLib {
19+
function deployVaultImpl(
20+
bytes32 salt,
21+
address underlying,
22+
uint16 referralCode,
23+
IPoolAddressesProvider poolAddressesProvider
24+
) external returns (address vault) {
25+
return address(new ATokenVault{salt: salt}(
26+
underlying,
27+
referralCode,
28+
poolAddressesProvider
29+
));
30+
}
31+
}
32+
1133
/**
1234
* @title ATokenVaultFactory
1335
* @author Aave Protocol
@@ -124,11 +146,12 @@ contract ATokenVaultFactory {
124146
currentCounter
125147
));
126148

127-
address implementation = address(new ATokenVault{salt: salt}(
149+
address implementation = ATokenVaultImplDeploymentLib.deployVaultImpl(
150+
salt,
128151
params.underlying,
129152
params.referralCode,
130153
params.poolAddressesProvider
131-
));
154+
);
132155

133156
vault = address(new TransparentUpgradeableProxy{salt: salt}(
134157
implementation,

0 commit comments

Comments
 (0)