Skip to content

Commit

Permalink
fix: patch harmony (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Jan 15, 2024
1 parent 901d692 commit 742f6b3
Show file tree
Hide file tree
Showing 78 changed files with 493 additions and 746 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@
},
"homepage": "https://github.com/bgd-labs/aave-address-book#readme",
"devDependencies": {
"@bgd-labs/js-utils": "^1.0.6",
"@types/node": "^20.10.5",
"esbuild-plugin-file-path-extensions": "^2.0.0",
"prettier": "^3.0.3",
"prettier-plugin-solidity": "^1.1.3",
"tsup": "^8.0.1",
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"viem": "^1.20.3"
"viem": "^2.0.10"
}
}
2 changes: 1 addition & 1 deletion scripts/configs/governance/arbitrum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

export const governanceConfigArbitrum: GovernanceConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/avalanche.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

export const governanceConfigFuji: GovernanceConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {GovernanceConfig} from '../types';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';

export const governanceConfigBase: GovernanceConfig = {
name: 'Base',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/bnb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {GovernanceConfig} from '../types';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';

export const governanceConfigBNB: GovernanceConfig = {
name: 'BNB',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/ethereum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

// OUTDATED ABI
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/gnosis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {GovernanceConfig} from '../types';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';

export const governanceConfigGnosis: GovernanceConfig = {
name: 'Gnosis',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/metis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {GovernanceConfig} from '../types';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';

export const governanceConfigMetis: GovernanceConfig = {
name: 'Metis',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/optimism.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

export const governanceConfigOptimism: GovernanceConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/polygon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

export const governanceConfigMumbai: GovernanceConfig = {
Expand Down
4 changes: 2 additions & 2 deletions scripts/configs/governance/polygonZkEvm.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

export const governanceConfigPolygonZkEvm: GovernanceConfig = {
name: 'PolygonZkEvm',
CHAIN_ID: ChainId.zkevm,
CHAIN_ID: ChainId.zkEVM,
ADDRESSES: {
CROSS_CHAIN_CONTROLLER: '0xed7e0874526B9BB9E36C7e9472ed7ed324CEeE3B',
PAYLOADS_CONTROLLER: '0xa2d22795E0D85D4Cb14Cbb14Df7bb8fec1016615',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/governance/scroll.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {GovernanceConfig} from '../types';

export const governanceConfigScroll: GovernanceConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/arbitrum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const arbitrumAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/avalanche.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const avalancheAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const baseAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/bnb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const bnbAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/ethereum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Hex} from 'viem';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {AddressInfo, NetworkAddresses} from '../types';

export const ethereumAddresses: NetworkAddresses<{
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/fantom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const fantomAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/gnosis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const gnosisAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/metis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const metisAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/optimism.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const optimismAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/polygon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Hex} from 'viem';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const polygonAddresses: NetworkAddresses<{AAVE_POL_ETH_BRIDGE: Hex}> = {
Expand Down
4 changes: 2 additions & 2 deletions scripts/configs/networks/polygonZkEvm.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {NetworkAddresses} from '../types';
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';

export const polygonZkEvmAddresses: NetworkAddresses = {
name: 'PolygonZkEvm',
chainId: ChainId.zkevm,
chainId: ChainId.zkEVM,
addresses: {
PARASWAP_FEE_CLAIMER: '0xAe940e61E9863178b71500c9B5faE2a04Da361a1',
TRANSPARENT_PROXY_FACTORY: '0x8B6851156023f4f5A66F68BEA80851c3D905Ac93',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/networks/scroll.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {NetworkAddresses} from '../types';

export const scrollAddresses: NetworkAddresses = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/arbitrum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const arbitrumGoerliProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/avalanche.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const fujiProtoV2: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const baseProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/bnb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const bnbProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/ethereum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const goerliProtoV2Pool: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/fantom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const fantomTestnetProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/gnosis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const gnosisProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/harmony.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const harmonyProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/metis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const metisProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/optimism.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const optimismGoerliProtoV3: PoolConfig = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/pools/polygon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const mumbaiProtoV2: PoolConfig = {
Expand Down
4 changes: 2 additions & 2 deletions scripts/configs/pools/polygonZkEvm.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const polygonZkEvmProtoV3: PoolConfig = {
name: 'PolygonZkEvm',
chainId: ChainId.zkevm,
chainId: ChainId.zkEVM,
POOL_ADDRESSES_PROVIDER: '0x36616cf17557639614c1cdDb356b1B83fc0B2132',
additionalAddresses: {
L2_ENCODER: '0x777fBA024bA1228fDa76149A4ff8B23475ed057D',
Expand Down
18 changes: 2 additions & 16 deletions scripts/configs/pools/scroll.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import {ChainId} from '../../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';
import {PoolConfig} from '../types';

export const scrollAlphaProtoV3: PoolConfig = {
name: 'ScrollAlpha',
chainId: ChainId.scroll_alpha,
POOL_ADDRESSES_PROVIDER: '0x52A27dC690F8652288194Dd2bc523863eBdEa236',
additionalAddresses: {
FAUCET: '0x357A307A8036D54b454BD15B3B1A0fE4B9e8A561',
L2_ENCODER: '0x3Bb33c67908D0d58F8d7349cBe726ff3b059e0fC',
UI_INCENTIVE_DATA_PROVIDER: '0xBf67A725F976d4A7C1fa9ea5303FD57D13CA0A37',
UI_POOL_DATA_PROVIDER: '0xDC55BcFC0963608401A4bA6298624E5895f8250a',
WALLET_BALANCE_PROVIDER: '0x6c68e975764a56e62AF3d1C8209F789779Eb763B',
WETH_GATEWAY: '0x57ce905CfD7f986A929A26b006f797d181dB706e',
},
};

export const scrollSepoliaProtoV3: PoolConfig = {
name: 'ScrollSepolia',
chainId: ChainId.scroll_sepolia,
Expand Down Expand Up @@ -43,7 +29,7 @@ export const scrollProtoV3: PoolConfig = {
UI_INCENTIVE_DATA_PROVIDER: '0x9E7DF170E44093d6738057157CA048794B02555d',
UI_POOL_DATA_PROVIDER: '0x29CF7aC4Fc122085c0D4DE8894f878F0b141F799',
WALLET_BALANCE_PROVIDER: '0x07D04EfAAA0Ac69D19d107795aF247C42Eb50F1C',
WETH_GATEWAY: '0x93c597e5229f76679d7646cC9161B59Cc0DE78B9'
WETH_GATEWAY: '0x93c597e5229f76679d7646cC9161B59Cc0DE78B9',
},
initial: {
COLLECTOR: '0x83a9EFE0485e7C227F29fe376132EfF746B45E96',
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Hex} from 'viem';
import {ChainId} from '../generator/chains';
import {ChainId} from '@bgd-labs/js-utils';

interface KnownInterfaces<T extends number | Hex = any> {
value: T;
Expand Down
12 changes: 7 additions & 5 deletions scripts/generateAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
polygonProtoV2,
polygonProtoV3,
} from './configs/pools/polygon';
import {scrollAlphaProtoV3, scrollSepoliaProtoV3, scrollProtoV3} from './configs/pools/scroll';
import {scrollSepoliaProtoV3, scrollProtoV3} from './configs/pools/scroll';
import {generateGovernanceLibrary} from './generator/governanceV3Generator';
import {generateProtocolV2Library} from './generator/protocolV2Generator';
import {generateProtocolV3Library} from './generator/protocolV3Generator';
Expand Down Expand Up @@ -67,7 +67,7 @@ async function main() {
if (existsSync('./src/ts')) {
const files = readdirSync('./src/ts');
for (const file of files) {
if (file !== 'abis') rmSync(`./src/ts/${file}`);
if (file !== 'abis' && file !== 'AaveV3Harmony.ts') rmSync(`./src/ts/${file}`);
}
} else {
mkdirSync('./src/ts');
Expand Down Expand Up @@ -123,11 +123,10 @@ async function main() {
optimismGoerliProtoV3,
optimismProtoV3,
scrollProtoV3,
scrollAlphaProtoV3,
scrollSepoliaProtoV3,
fantomTestnetProtoV3,
fantomProtoV3,
harmonyProtoV3,
// harmonyProtoV3,
].map((config) => generateProtocolV3Library(config)),
);

Expand Down Expand Up @@ -164,7 +163,10 @@ async function main() {
abis,
].flat();

const jsExports = imports.map((f) => f.js).flat();
const jsExports = [
...imports.map((f) => f.js).flat(),
"export * as AaveV3Harmony from './AaveV3Harmony';",
];
writeFileSync(`./src/ts/AaveAddressBook.ts`, prefixWithGeneratedWarning(''));
jsExports.map((jsExport) => appendFileSync('./src/ts/AaveAddressBook.ts', `${jsExport}\n`));

Expand Down
2 changes: 1 addition & 1 deletion scripts/generator/assetsLibraryGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Hex, zeroAddress} from 'viem';
import {ReserveData} from '../configs/types';
import {generateSolidityConstants, wrapIntoSolidityLibrary} from './utils';
import {ChainId} from './chains';
import {ChainId} from '@bgd-labs/js-utils';

/**
* As symbols are used as variable name in Solidity and Javascript there are certain characters that are not allowed and should be replaced.
Expand Down
27 changes: 0 additions & 27 deletions scripts/generator/chains.ts

This file was deleted.

Loading

0 comments on commit 742f6b3

Please sign in to comment.