Skip to content

Commit 264fae5

Browse files
feat: linea script and use rpc env (aave-dao#28)
* feat: linea script and use rpc env * fix: js test
1 parent 72e78d7 commit 264fae5

File tree

13 files changed

+49
-11
lines changed

13 files changed

+49
-11
lines changed

foundry.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ test = 'tests'
44
script = 'scripts'
55
out = 'out'
66
solc = '0.8.20'
7+
optimizer = true
8+
optimizer_runs = 200
79
libs = ['lib']
810
remappings = [
911
]
@@ -27,6 +29,9 @@ fallback_oz = true
2729
optimizer_mode = 'z'
2830
zksolc = '1.5.7'
2931

32+
[profile.linea]
33+
evm_version = 'london'
34+
3035
[rpc_endpoints]
3136
mainnet = "${RPC_MAINNET}"
3237
optimism = "${RPC_OPTIMISM}"
@@ -42,6 +47,7 @@ gnosis = "${RPC_GNOSIS}"
4247
bnb = "${RPC_BNB}"
4348
scroll = "${RPC_SCROLL}"
4449
zksync = "${RPC_ZKSYNC}"
50+
linea = "${RPC_LINEA}"
4551

4652
[etherscan]
4753
mainnet = { key="${ETHERSCAN_API_KEY_MAINNET}", chainId=1 }
@@ -57,5 +63,6 @@ gnosis = { key="${ETHERSCAN_API_KEY_GNOSIS}", chainId=100 }
5763
bnb = { key="${ETHERSCAN_API_KEY_BNB}", chainId=56, url='https://api.bscscan.com/api' }
5864
scroll = { key="${ETHERSCAN_API_KEY_SCROLL}", chainId= 534352 }
5965
zksync = { key="${ETHERSCAN_API_KEY_ZKSYNC}", chainId= 324 }
66+
linea = { key="${ETHERSCAN_API_KEY_LINEA}", chain = 59144 }
6067

6168
# See more config options https://github.com/gakonst/foundry/tree/master/config

generator/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {collateralsUpdates} from './features/collateralsUpdates';
1616
import {lstPriceCapsUpdates} from './features/lstPriceCapsUpdates';
1717
import {stablePriceCapsUpdates} from './features/stablePriceCapsUpdates';
1818
import {generateFiles, writeFiles} from './generator';
19-
import {CHAIN_ID_CLIENT_MAP} from '@bgd-labs/js-utils';
19+
import {getClient} from '@bgd-labs/rpc-env';
2020
import {getBlockNumber} from 'viem/actions';
2121

2222
const program = new Command();
@@ -47,7 +47,7 @@ const FEATURE_MODULES_V3 = [
4747

4848
async function generateDeterministicPoolCache(pool: PoolIdentifier): Promise<PoolCache> {
4949
const chain = getPoolChain(pool);
50-
const client = CHAIN_ID_CLIENT_MAP[CHAIN_TO_CHAIN_ID[chain]];
50+
const client = getClient(CHAIN_TO_CHAIN_ID[chain], {});
5151
return {blockNumber: Number(await getBlockNumber(client))};
5252
}
5353

generator/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
gnosis,
1313
scroll,
1414
zkSync,
15+
linea
1516
} from 'viem/chains';
1617

1718
export const AVAILABLE_CHAINS = [
@@ -28,6 +29,7 @@ export const AVAILABLE_CHAINS = [
2829
'Gnosis',
2930
'Scroll',
3031
'ZkSync',
32+
'Linea'
3133
] as const;
3234

3335
export function getAssets(pool: PoolIdentifier): string[] {
@@ -111,6 +113,7 @@ export const CHAIN_TO_CHAIN_ID = {
111113
Gnosis: gnosis.id,
112114
Scroll: scroll.id,
113115
ZkSync: zkSync.id,
116+
Linea: linea.id,
114117
};
115118

116119
export function flagAsRequired(message: string, required?: boolean) {

generator/features/__snapshots__/capUpdates.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {IAaveV3ConfigEngine} from 'aave-v3-origin/src/contracts/extensions/v3-co
3434
* @title test
3535
* @author test
3636
* - discussion: test
37-
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true
37+
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true skip_timelock=false
3838
*/
3939
contract AaveV3Ethereum_Test_20231023 is RiskStewardsEthereum {
4040
function name() public pure override returns (string memory) {

generator/features/__snapshots__/collateralUpdates.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {IAaveV3ConfigEngine} from 'aave-v3-origin/src/contracts/extensions/v3-co
4646
* @title test
4747
* @author test
4848
* - discussion: test
49-
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true
49+
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true skip_timelock=false
5050
*/
5151
contract AaveV3Ethereum_Test_20231023 is RiskStewardsEthereum {
5252
function name() public pure override returns (string memory) {

generator/features/__snapshots__/lstPriceCapUpdates.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import {IRiskSteward, IPriceCapAdapter} from '../../../interfaces/IRiskSteward.s
4343
* @title test
4444
* @author test
4545
* - discussion: test
46-
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true
46+
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true skip_timelock=false
4747
*/
4848
contract AaveV3Ethereum_Test_20231023 is RiskStewardsEthereum {
4949
function name() public pure override returns (string memory) {

generator/features/__snapshots__/rateUpdates.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ import {IAaveV3ConfigEngine} from 'aave-v3-origin/src/contracts/extensions/v3-co
8383
* @title test
8484
* @author test
8585
* - discussion: test
86-
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true
86+
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true skip_timelock=false
8787
*/
8888
contract AaveV3Ethereum_Test_20231023 is RiskStewardsEthereum {
8989
function name() public pure override returns (string memory) {

generator/features/__snapshots__/stablePriceCapUpdates.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {IRiskSteward} from '../../../interfaces/IRiskSteward.sol';
3434
* @title test
3535
* @author test
3636
* - discussion: test
37-
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true
37+
* - deploy-command: make run-script contract=src/contracts/updates/20231023_AaveV3Ethereum_Test/AaveV3Ethereum_Test_20231023.sol:AaveV3Ethereum_Test_20231023 network=mainnet broadcast=false generate_diff=true skip_timelock=false
3838
*/
3939
contract AaveV3Ethereum_Test_20231023 is RiskStewardsEthereum {
4040
function name() public pure override returns (string memory) {

generator/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export const V3_POOLS = [
2020
'AaveV3Gnosis',
2121
'AaveV3Scroll',
2222
'AaveV3BNB',
23-
'AaveV3ZkSync'
23+
'AaveV3ZkSync',
24+
'AaveV3Linea',
2425
] as const satisfies readonly (keyof typeof addressBook)[];
2526

2627
export const POOLS = [

0 commit comments

Comments
 (0)