Skip to content

Commit

Permalink
fix: initial addresses (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlymite authored Jan 20, 2025
1 parent 9489562 commit 837214a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions safe.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2044,8 +2044,11 @@ address,name,chainId
0x2D97F8FA96886Fd923c065F5457F9DDd494e3877,AaveV3Linea AAVE_PROTOCOL_DATA_PROVIDER,59144
0x8c2d95FE7aeB57b86961F3abB296A54f0ADb7F88,AaveV3Linea ACL_ADMIN,59144
0xbf32c7dFC72b730967072B112927ca0de205dbb5,AaveV3Linea ACL_MANAGER,59144
0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809,AaveV3Linea COLLECTOR,59144
0x6c23bAF050ec192afc0B967a93b83e6c5405df43,AaveV3Linea CONFIG_ENGINE,59144
0x589750BA8aF186cE5B55391B0b7148cAD43a1619,AaveV3Linea DEFAULT_A_TOKEN_IMPL_REV_1,59144
0xc67bb8F2314fA0df50cBa314c6509A7bdAD500C0,AaveV3Linea DEFAULT_INCENTIVES_CONTROLLER,59144
0xBeC519531F0E78BcDdB295242fA4EC5251B38574,AaveV3Linea DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1,59144
0x0165C65FB21bDC9Cdc09C627d62AB3a983337158,AaveV3Linea EMISSION_MANAGER,59144
0xCFDAdA7DCd2e785cF706BaDBC2B8Af5084d595e9,AaveV3Linea ORACLE,59144
0xc47b8C00b0f69a36fa203Ffeac0334874574a8Ac,AaveV3Linea POOL,59144
Expand Down
10 changes: 9 additions & 1 deletion scripts/generator/protocol-v3-generator/fetchTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {IStataTokenFactory_ABI} from '../../../src/ts/abis/IStataTokenFactory';
import {PoolConfig, ReserveData} from '../../configs/types';
import {IERC20Detailed_ABI} from '../../../src/ts/abis/IERC20Detailed';
import {fetchPoolAddresses} from './fetchPoolAddresses';
import {bytes32toAddress, getImplementationStorageSlot} from '../utils';
import {bytes32toAddress, getImplementationStorageSlot, addressOrZero} from '../utils';
import {IAToken_ABI} from '../../../src/ts/abis/IAToken';

export async function fetchTokens(
Expand Down Expand Up @@ -69,6 +69,7 @@ export async function fetchTokens(

export async function inferAdditionalTokenInfo(
client: Client,
poolConfig: PoolConfig,
reservesData: Awaited<ReturnType<typeof fetchTokens>>,
) {
if (reservesData.length > 0) {
Expand Down Expand Up @@ -123,4 +124,11 @@ export async function inferAdditionalTokenInfo(
defaultVariableDebtTokenImplementation,
};
}
return {
COLLECTOR: {value: addressOrZero(poolConfig.initial?.COLLECTOR), type: 'ICollector'},
DEFAULT_A_TOKEN_IMPL_REV_1: addressOrZero(poolConfig.initial?.DEFAULT_A_TOKEN_IMPL),
DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1: addressOrZero(
poolConfig.initial?.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL,
),
};
}
2 changes: 1 addition & 1 deletion scripts/generator/protocolV3Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function generateProtocolV3Library(poolConfig: PoolConfig) {
}
const poolAddresses = await fetchPoolAddresses(client, poolConfig);
const reservesData = await fetchTokens(client, poolConfig, poolAddresses);
const additionalTokenInfo = await inferAdditionalTokenInfo(client, reservesData);
const additionalTokenInfo = await inferAdditionalTokenInfo(client, poolConfig, reservesData);
const name = `AaveV3${poolConfig.name}`;

// generate main library
Expand Down
10 changes: 10 additions & 0 deletions src/AaveV3Linea.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ library AaveV3Linea {
// https://lineascan.build/address/0x0165C65FB21bDC9Cdc09C627d62AB3a983337158
address internal constant EMISSION_MANAGER = 0x0165C65FB21bDC9Cdc09C627d62AB3a983337158;

// https://lineascan.build/address/0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809
ICollector internal constant COLLECTOR = ICollector(0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809);

// https://lineascan.build/address/0x589750BA8aF186cE5B55391B0b7148cAD43a1619
address internal constant DEFAULT_A_TOKEN_IMPL_REV_1 = 0x589750BA8aF186cE5B55391B0b7148cAD43a1619;

// https://lineascan.build/address/0xBeC519531F0E78BcDdB295242fA4EC5251B38574
address internal constant DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1 =
0xBeC519531F0E78BcDdB295242fA4EC5251B38574;

// https://lineascan.build/address/0x6c23bAF050ec192afc0B967a93b83e6c5405df43
address internal constant CONFIG_ENGINE = 0x6c23bAF050ec192afc0B967a93b83e6c5405df43;

Expand Down
9 changes: 9 additions & 0 deletions src/ts/AaveV3Linea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ export const DEFAULT_INCENTIVES_CONTROLLER = '0xc67bb8F2314fA0df50cBa314c6509A7b
// https://lineascan.build/address/0x0165C65FB21bDC9Cdc09C627d62AB3a983337158
export const EMISSION_MANAGER = '0x0165C65FB21bDC9Cdc09C627d62AB3a983337158';

// ICollector https://lineascan.build/address/0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809
export const COLLECTOR = '0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809';

// https://lineascan.build/address/0x589750BA8aF186cE5B55391B0b7148cAD43a1619
export const DEFAULT_A_TOKEN_IMPL_REV_1 = '0x589750BA8aF186cE5B55391B0b7148cAD43a1619';

// https://lineascan.build/address/0xBeC519531F0E78BcDdB295242fA4EC5251B38574
export const DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1 = '0xBeC519531F0E78BcDdB295242fA4EC5251B38574';

// https://lineascan.build/address/0x6c23bAF050ec192afc0B967a93b83e6c5405df43
export const CONFIG_ENGINE = '0x6c23bAF050ec192afc0B967a93b83e6c5405df43';

Expand Down
9 changes: 9 additions & 0 deletions tests/cache/verified.json
Original file line number Diff line number Diff line change
Expand Up @@ -6608,6 +6608,15 @@
},
"0x3238FC1d642b60F41a35f62570237656C85F4744": {
"name": "RiskSteward"
},
"0x589750BA8aF186cE5B55391B0b7148cAD43a1619": {
"name": "ATokenInstance"
},
"0x86E2938daE289763D4e09a7e42c5cCcA62Cf9809": {
"name": "TransparentUpgradeableProxy"
},
"0xBeC519531F0E78BcDdB295242fA4EC5251B38574": {
"name": "VariableDebtTokenInstance"
}
},
"84532": {
Expand Down
1 change: 1 addition & 0 deletions tests/sanity/configEngine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function check(addresses: Record<string, any>) {
throw new Error('SANITY_CONFIG_ENGINE: wrong DEFAULT_INCENTIVES_CONTROLLER');
if (COLLECTOR !== addresses.COLLECTOR) throw new Error('SANITY_CONFIG_ENGINE: wrong COLLECTOR');
if (
addresses.ASSETS.length > 0 &&
DEFAULT_INTEREST_RATE_STRATEGY !==
(Object.values(addresses.ASSETS)[0] as any).INTEREST_RATE_STRATEGY
)
Expand Down

0 comments on commit 837214a

Please sign in to comment.