Skip to content

Commit

Permalink
fix: script and tests naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ianflexa committed Nov 5, 2024
1 parent eaaa041 commit 063a72b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 63 deletions.
12 changes: 6 additions & 6 deletions scripts/DeployZkSync.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ library CapAdaptersCodeZkSync {
address public constant sUSDe_USDe_AGGREGATOR = 0x97920183c36B022B46D6C14b9dA36c5f31A98C6A;
address public constant USDe_PRICE_FEED = 0x4899faF0b6c36620168D00e3DbD4CB9361244c4d;

function weETHAdapterCode() internal pure returns (bytes memory) {
function weETHAdapterParams() internal pure returns (bytes memory) {
return
abi.encode(
IPriceCapAdapter.CapAdapterParams({
Expand All @@ -31,7 +31,7 @@ library CapAdaptersCodeZkSync {
);
}

function sUSDeAdapterCode() internal pure returns (bytes memory) {
function sUSDeAdapterParams() internal pure returns (bytes memory) {
return
abi.encode(
IPriceCapAdapter.CapAdapterParams({
Expand All @@ -49,7 +49,7 @@ library CapAdaptersCodeZkSync {
);
}

function USDeAdapterCode() internal pure returns (bytes memory) {
function USDeAdapterParams() internal pure returns (bytes memory) {
return
abi.encode(
IPriceCapAdapterStable.CapAdapterStableParams({
Expand All @@ -65,15 +65,15 @@ library CapAdaptersCodeZkSync {
contract DeployWeEthZkSync is ZkSyncScript {
function run() external broadcast {
new CLRatePriceCapAdapter{salt: 'capo'}(
abi.decode(CapAdaptersCodeZkSync.weETHAdapterCode(), (IPriceCapAdapter.CapAdapterParams))
abi.decode(CapAdaptersCodeZkSync.weETHAdapterParams(), (IPriceCapAdapter.CapAdapterParams))
);
}
}

contract DeploySUSDeZkSync is ZkSyncScript {
function run() external broadcast {
new CLRatePriceCapAdapter{salt: 'capo'}(
abi.decode(CapAdaptersCodeZkSync.sUSDeAdapterCode(), (IPriceCapAdapter.CapAdapterParams))
abi.decode(CapAdaptersCodeZkSync.sUSDeAdapterParams(), (IPriceCapAdapter.CapAdapterParams))
);
}
}
Expand All @@ -82,7 +82,7 @@ contract DeployUSDeZkSync is ZkSyncScript {
function run() external broadcast {
new PriceCapAdapterStable{salt: 'capo'}(
abi.decode(
CapAdaptersCodeZkSync.USDeAdapterCode(),
CapAdaptersCodeZkSync.USDeAdapterParams(),
(IPriceCapAdapterStable.CapAdapterStableParams)
)
);
Expand Down
17 changes: 2 additions & 15 deletions tests/zksync/USDePriceCapAdapterZkSyncTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,11 @@ import {AaveV3ZkSync} from 'aave-address-book/AaveV3ZkSync.sol';
contract USDePriceCapAdapterZKSyncTest is BaseStableTest {
constructor()
BaseStableTest(
CapAdaptersCodeZkSync.USDeAdapterCode(),
CapAdaptersCodeZkSync.USDeAdapterParams(),
10,
ForkParams({network: 'zksync', blockNumber: 47910214})
)
{}

function _capAdapterParams()
internal
pure
override
returns (IPriceCapAdapterStable.CapAdapterStableParams memory)
{
return
IPriceCapAdapterStable.CapAdapterStableParams({
aclManager: AaveV3ZkSync.ACL_MANAGER,
assetToUsdAggregator: IChainlinkAggregator(CapAdaptersCodeZkSync.USDe_PRICE_FEED),
adapterDescription: 'Capped USDe / USD',
priceCap: int256(1.04 * 1e8)
});
}

}
23 changes: 2 additions & 21 deletions tests/zksync/sUSDePriceCapAdapterZkSyncTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {AaveV3ZkSync} from 'aave-address-book/AaveV3ZkSync.sol';
contract sUSDePriceCapAdapterZkSyncTest is BaseTest {
constructor()
BaseTest(
CapAdaptersCodeZkSync.sUSDeAdapterCode(),
CapAdaptersCodeZkSync.sUSDeAdapterParams(),
8,
ForkParams({network: 'zksync', blockNumber: 47910214}),
'sUSDe_ZkSync'
Expand All @@ -23,24 +23,5 @@ contract sUSDePriceCapAdapterZkSyncTest is BaseTest {
return new CLRatePriceCapAdapter{salt: 'test'}(capAdapterParams);
}

function _capAdapterParams()
internal
pure
override
returns (IPriceCapAdapter.CapAdapterParams memory)
{
return
IPriceCapAdapter.CapAdapterParams({
aclManager: AaveV3ZkSync.ACL_MANAGER,
baseAggregatorAddress: CapAdaptersCodeZkSync.USDe_PRICE_FEED,
ratioProviderAddress: CapAdaptersCodeZkSync.sUSDe_USDe_AGGREGATOR,
pairDescription: 'Capped sUSDe / USDe / USD',
minimumSnapshotDelay: 14 days,
priceCapParams: IPriceCapAdapter.PriceCapUpdateParams({
snapshotRatio: 1_108087487354065863,
snapshotTimestamp: 1729101653, // 16th of October 2024
maxYearlyRatioGrowthPercent: 50_00
})
});
}

}
23 changes: 2 additions & 21 deletions tests/zksync/weETHPriceCapAdapterZkSyncTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {AaveV3ZkSync, AaveV3ZkSyncAssets} from 'aave-address-book/AaveV3ZkSync.s
contract weETHPriceCapAdapterZkSyncTest is BaseTest {
constructor()
BaseTest(
CapAdaptersCodeZkSync.weETHAdapterCode(),
CapAdaptersCodeZkSync.weETHAdapterParams(),
8,
ForkParams({network: 'zksync', blockNumber: 47840214}),
'weETH_ZkSync'
Expand All @@ -23,24 +23,5 @@ contract weETHPriceCapAdapterZkSyncTest is BaseTest {
return new CLRatePriceCapAdapter{salt: 'test'}(capAdapterParams);
}

function _capAdapterParams()
internal
pure
override
returns (IPriceCapAdapter.CapAdapterParams memory)
{
return
IPriceCapAdapter.CapAdapterParams({
aclManager: AaveV3ZkSync.ACL_MANAGER,
baseAggregatorAddress: AaveV3ZkSyncAssets.WETH_ORACLE,
ratioProviderAddress: CapAdaptersCodeZkSync.weETH_eETH_AGGREGATOR,
pairDescription: 'Capped weETH / eETH(ETH) / USD',
minimumSnapshotDelay: 7 days,
priceCapParams: IPriceCapAdapter.PriceCapUpdateParams({
snapshotRatio: 1_050999130243073606,
snapshotTimestamp: 1729748180, // 24th of October 2024
maxYearlyRatioGrowthPercent: 8_75
})
});
}

}

0 comments on commit 063a72b

Please sign in to comment.