Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ zksolc = '1.5.7'
[profile.linea]
evm_version = 'london'

[profile.sonic]
evm_version = 'cancun'

[rpc_endpoints]
mainnet = "${RPC_MAINNET}"
optimism = "${RPC_OPTIMISM}"
Expand All @@ -48,6 +51,7 @@ bnb = "${RPC_BNB}"
scroll = "${RPC_SCROLL}"
zksync = "${RPC_ZKSYNC}"
linea = "${RPC_LINEA}"
sonic = "${RPC_SONIC}"

[etherscan]
mainnet = { key="${ETHERSCAN_API_KEY_MAINNET}", chainId=1 }
Expand All @@ -64,5 +68,6 @@ bnb = { key="${ETHERSCAN_API_KEY_BNB}", chainId=56, url='https://api.bscscan.com
scroll = { key="${ETHERSCAN_API_KEY_SCROLL}", chainId= 534352 }
zksync = { key="${ETHERSCAN_API_KEY_ZKSYNC}", chainId= 324 }
linea = { key="${ETHERSCAN_API_KEY_LINEA}", chain = 59144 }
sonic = { key="${ETHERSCAN_API_KEY_SONIC}", chain = 146 }

# See more config options https://github.com/gakonst/foundry/tree/master/config
7 changes: 5 additions & 2 deletions generator/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
gnosis,
scroll,
zkSync,
linea
linea,
sonic,
} from 'viem/chains';

export const AVAILABLE_CHAINS = [
Expand All @@ -29,7 +30,8 @@ export const AVAILABLE_CHAINS = [
'Gnosis',
'Scroll',
'ZkSync',
'Linea'
'Linea',
'Sonic',
] as const;

export function getAssets(pool: PoolIdentifier): string[] {
Expand Down Expand Up @@ -114,6 +116,7 @@ export const CHAIN_TO_CHAIN_ID = {
Scroll: scroll.id,
ZkSync: zkSync.id,
Linea: linea.id,
Sonic: sonic.id,
};

export function flagAsRequired(message: string, required?: boolean) {
Expand Down
5 changes: 2 additions & 3 deletions generator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ export const V3_POOLS = [
'AaveV3BNB',
'AaveV3ZkSync',
'AaveV3Linea',
'AaveV3Sonic',
] as const satisfies readonly (keyof typeof addressBook)[];

export const POOLS = [
...V3_POOLS,
] as const satisfies readonly (keyof typeof addressBook)[];
export const POOLS = [...V3_POOLS] as const satisfies readonly (keyof typeof addressBook)[];

export type PoolIdentifier = (typeof POOLS)[number];
export type PoolIdentifierV3 = (typeof V3_POOLS)[number];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ethers": "5.7.2",
"ts-node": "^10.9.1",
"tsx": "^4.16.3",
"viem": "^2.18.6",
"viem": "^2.23.6",
"typescript": "^5.0.4"
}
}
16 changes: 16 additions & 0 deletions scripts/deploy/DeployStewards.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {AaveV3Metis} from 'aave-address-book/AaveV3Metis.sol';
import {GovernanceV3Metis} from 'aave-address-book/GovernanceV3Metis.sol';
import {AaveV3Linea} from 'aave-address-book/AaveV3Linea.sol';
import {GovernanceV3Linea} from 'aave-address-book/GovernanceV3Linea.sol';
import {AaveV3Sonic} from 'aave-address-book/AaveV3Sonic.sol';
import {GovernanceV3Sonic} from 'aave-address-book/GovernanceV3Sonic.sol';
import {IOwnable} from 'aave-address-book/common/IOwnable.sol';
import {RiskSteward, IRiskSteward, IPoolDataProvider, IEngine} from '../../src/contracts/RiskSteward.sol';

Expand Down Expand Up @@ -257,3 +259,17 @@ contract DeployLinea is LineaScript {
vm.stopBroadcast();
}
}

// make deploy-ledger contract=scripts/deploy/DeployStewards.s.sol:DeploySonic chain=sonic
contract DeploySonic is SonicScript {
function run() external {
vm.startBroadcast();
DeployRiskStewards._deployRiskStewards(
address(AaveV3Sonic.AAVE_PROTOCOL_DATA_PROVIDER),
AaveV3Sonic.CONFIG_ENGINE,
0x1dE39A17a9Fa8c76899fff37488482EEb7835d04, // sonic-risk-council
GovernanceV3Sonic.EXECUTOR_LVL_1
);
vm.stopBroadcast();
}
}
9 changes: 9 additions & 0 deletions scripts/networks/RiskStewardsSonic.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3Sonic} from 'aave-address-book/AaveV3Sonic.sol';
import {RiskStewardsBase} from '../RiskStewardsBase.s.sol';

abstract contract RiskStewardsSonic is RiskStewardsBase {
constructor() RiskStewardsBase(address(AaveV3Sonic.POOL), AaveV3Sonic.RISK_STEWARD) {}
}
27 changes: 27 additions & 0 deletions src/contracts/examples/SonicExample.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {AaveV3SonicAssets} from 'aave-address-book/AaveV3Sonic.sol';
import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-origin/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {EngineFlags} from 'aave-v3-origin/src/contracts/extensions/v3-config-engine/EngineFlags.sol';
import {RiskStewardsSonic} from '../../../scripts/networks/RiskStewardsSonic.s.sol';

// make run-script network=sonic contract=src/contracts/examples/SonicExample.sol:SonicExample broadcast=false generate_diff=true skip_timelock=false
contract SonicExample is RiskStewardsSonic {
/**
* @return string name identifier used for the diff
*/
function name() public pure override returns (string memory) {
return 'sonic_example';
}

function capsUpdates() public pure override returns (IEngine.CapsUpdate[] memory) {
IEngine.CapsUpdate[] memory capUpdates = new IEngine.CapsUpdate[](1);
capUpdates[0] = IEngine.CapsUpdate(
AaveV3SonicAssets.wS_UNDERLYING,
21_000_000,
EngineFlags.KEEP_CURRENT
);
return capUpdates;
}
}
2 changes: 1 addition & 1 deletion tests/RiskSteward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract RiskSteward_Test is Test {
event RiskConfigSet(IRiskSteward.Config indexed riskConfig);

function setUp() public virtual {
vm.createSelectFork(vm.rpcUrl('mainnet'), 20934847);
vm.createSelectFork(vm.rpcUrl('mainnet'), 21974363);

configEngine = AaveV3Ethereum.CONFIG_ENGINE;

Expand Down
Loading