Skip to content

Commit

Permalink
feat: add aave v1 (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Mar 21, 2024
1 parent d9cb3d1 commit c614b39
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/generateAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import {polygonZkEvmAddresses} from './configs/networks/polygonZkEvm';
import {governanceConfigScroll} from './configs/governance/scroll';
import {governanceConfigPolygonZkEvm} from './configs/governance/polygonZkEvm';
import {generateTokenList} from './generator/generateTokenList';
import {generateAaveV1} from './generator/protocolV1Generator';

async function main() {
// cleanup ts artifacts
Expand Down Expand Up @@ -90,6 +91,7 @@ async function main() {
governanceConfigPolygonZkEvm,
].map((config) => generateGovernanceLibrary(config)),
);
const v1Library = generateAaveV1();
const v2LibraryNames = await Promise.all(
[
mainnetAmmV2Pool,
Expand Down Expand Up @@ -158,6 +160,7 @@ async function main() {

const imports = [
governanceNames,
v1Library,
v2LibraryNames,
v3LibraryNames,
networkAddresses,
Expand Down
47 changes: 47 additions & 0 deletions scripts/generator/protocolV1Generator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as fs from 'fs';
import {Addresses} from '../configs/types';
import {
generateJsConstants,
generateSolidityConstants,
prefixWithGeneratedWarning,
prefixWithPragma,
wrapIntoSolidityLibrary,
} from './utils';
import {ChainId} from '@bgd-labs/js-utils';

const v1Addresses: Addresses = {
ADDRESSES_PROVIDER: '0x24a42fD28C976A61Df5D00D0599C34c4f90748c8',
CORE: '0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3',
POOL: '0x398eC7346DcD622eDc5ae82352F02bE94C62d119',
};

export function generateAaveV1() {
const name = 'AaveV1';

fs.writeFileSync(
`./src/AaveV1.sol`,
prefixWithGeneratedWarning(
prefixWithPragma(
wrapIntoSolidityLibrary(
generateSolidityConstants({chainId: ChainId.mainnet, addresses: v1Addresses}),
name,
),
),
),
);

fs.writeFileSync(
`./src/ts/AaveV1.ts`,
prefixWithGeneratedWarning(
generateJsConstants({
chainId: ChainId.mainnet,
addresses: {...v1Addresses, CHAIN_ID: {value: 1, type: 'uint256'}},
}).join('\n'),
),
);

return {
js: [`export * as ${name} from './${name}';`],
solidity: [`import {${name}} from './${name}.sol';`],
};
}
1 change: 1 addition & 0 deletions src/AaveAddressBook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {GovernanceV3BNB} from './GovernanceV3BNB.sol';
import {GovernanceV3Gnosis} from './GovernanceV3Gnosis.sol';
import {GovernanceV3Scroll} from './GovernanceV3Scroll.sol';
import {GovernanceV3PolygonZkEvm} from './GovernanceV3PolygonZkEvm.sol';
import {AaveV1} from './AaveV1.sol';
import {AaveV2EthereumAMM} from './AaveV2EthereumAMM.sol';
import {AaveV2EthereumArc} from './AaveV2EthereumArc.sol';
import {AaveV2Ethereum} from './AaveV2Ethereum.sol';
Expand Down
14 changes: 14 additions & 0 deletions src/AaveV1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

library AaveV1 {
// https://etherscan.io/address/0x24a42fD28C976A61Df5D00D0599C34c4f90748c8
address internal constant ADDRESSES_PROVIDER = 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8;

// https://etherscan.io/address/0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3
address internal constant CORE = 0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3;

// https://etherscan.io/address/0x398eC7346DcD622eDc5ae82352F02bE94C62d119
address internal constant POOL = 0x398eC7346DcD622eDc5ae82352F02bE94C62d119;
}
1 change: 1 addition & 0 deletions src/ts/AaveAddressBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * as GovernanceV3BNB from './GovernanceV3BNB';
export * as GovernanceV3Gnosis from './GovernanceV3Gnosis';
export * as GovernanceV3Scroll from './GovernanceV3Scroll';
export * as GovernanceV3PolygonZkEvm from './GovernanceV3PolygonZkEvm';
export * as AaveV1 from './AaveV1';
export * as AaveV2EthereumAMM from './AaveV2EthereumAMM';
export * as AaveV2EthereumArc from './AaveV2EthereumArc';
export * as AaveV2Ethereum from './AaveV2Ethereum';
Expand Down
11 changes: 11 additions & 0 deletions src/ts/AaveV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// AUTOGENERATED - MANUALLY CHANGES WILL BE REVERTED BY THE GENERATOR
// https://etherscan.io/address/0x24a42fD28C976A61Df5D00D0599C34c4f90748c8
export const ADDRESSES_PROVIDER = '0x24a42fD28C976A61Df5D00D0599C34c4f90748c8';

// https://etherscan.io/address/0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3
export const CORE = '0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3';

// https://etherscan.io/address/0x398eC7346DcD622eDc5ae82352F02bE94C62d119
export const POOL = '0x398eC7346DcD622eDc5ae82352F02bE94C62d119';

export const CHAIN_ID = 1;

0 comments on commit c614b39

Please sign in to comment.