generated from bgd-labs/bgd-forge-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
import {GovV3Helpers} from 'aave-helpers/GovV3Helpers.sol'; | ||
import {ZkSyncScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; | ||
import {CLRatePriceCapAdapter} from '../src/contracts/CLRatePriceCapAdapter.sol'; | ||
import {AaveV3ZkSync, AaveV3ZkSyncAssets} from 'aave-address-book/AaveV3ZkSync.sol'; | ||
import {PriceCapAdapterStable} from '../src/contracts/PriceCapAdapterStable.sol'; | ||
import {IPriceCapAdapterStable} from '../src/interfaces/IPriceCapAdapterStable.sol'; | ||
import {IPriceCapAdapter, IChainlinkAggregator} from '../src/interfaces/IPriceCapAdapter.sol'; | ||
|
||
library CapAdaptersCodeZkSync { | ||
address public constant weETH_eETH_AGGREGATOR = 0x8D3184a992f93729b249407C33F1e78abE0d650e; | ||
address public constant sUSDe_USDe_AGGREGATOR = 0x97920183c36B022B46D6C14b9dA36c5f31A98C6A; | ||
address public constant USDe_PRICE_FEED = 0x4899faF0b6c36620168D00e3DbD4CB9361244c4d; | ||
|
||
function weETHAdapterCode() internal pure returns (bytes memory) { | ||
return | ||
abi.encode( | ||
IPriceCapAdapter.CapAdapterParams({ | ||
aclManager: AaveV3ZkSync.ACL_MANAGER, | ||
baseAggregatorAddress: AaveV3ZkSyncAssets.WETH_ORACLE, | ||
ratioProviderAddress: 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 | ||
}) | ||
}) | ||
); | ||
} | ||
|
||
function sUSDeAdapterCode() internal pure returns (bytes memory) { | ||
return | ||
abi.encode( | ||
IPriceCapAdapter.CapAdapterParams({ | ||
aclManager: AaveV3ZkSync.ACL_MANAGER, | ||
baseAggregatorAddress: USDe_PRICE_FEED, | ||
ratioProviderAddress: 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 | ||
}) | ||
}) | ||
); | ||
} | ||
|
||
function USDeAdapterCode() internal pure returns (bytes memory) { | ||
return | ||
abi.encode( | ||
IPriceCapAdapterStable.CapAdapterStableParams({ | ||
aclManager: AaveV3ZkSync.ACL_MANAGER, | ||
assetToUsdAggregator: IChainlinkAggregator(USDe_PRICE_FEED), | ||
adapterDescription: 'Capped USDe / USD', | ||
priceCap: int256(1.04 * 1e8) | ||
}) | ||
); | ||
} | ||
} | ||
|
||
contract DeployWeEthZkSync is ZkSyncScript { | ||
function run() external broadcast { | ||
new CLRatePriceCapAdapter{salt: 'capo'}( | ||
abi.decode(CapAdaptersCodeZkSync.weETHAdapterCode(), (IPriceCapAdapter.CapAdapterParams)) | ||
); | ||
} | ||
} | ||
|
||
contract DeploySUSDeZkSync is ZkSyncScript { | ||
function run() external broadcast { | ||
new CLRatePriceCapAdapter{salt: 'capo'}( | ||
abi.decode(CapAdaptersCodeZkSync.sUSDeAdapterCode(), (IPriceCapAdapter.CapAdapterParams)) | ||
); | ||
} | ||
} | ||
|
||
contract DeployUSDeZkSync is ZkSyncScript { | ||
function run() external broadcast { | ||
new PriceCapAdapterStable{salt: 'capo'}( | ||
abi.decode( | ||
CapAdaptersCodeZkSync.USDeAdapterCode(), | ||
(IPriceCapAdapterStable.CapAdapterStableParams) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import '../BaseStableTest.sol'; | ||
import {PriceCapAdapterStable, IChainlinkAggregator} from '../../src/contracts/PriceCapAdapterStable.sol'; | ||
import {CapAdaptersCodeZkSync} from '../../scripts/DeployZkSync.s.sol'; | ||
import {AaveV3ZkSync} from 'aave-address-book/AaveV3ZkSync.sol'; | ||
|
||
contract USDePriceCapAdapterZKSyncTest is BaseStableTest { | ||
constructor() | ||
BaseStableTest( | ||
CapAdaptersCodeZkSync.USDeAdapterCode(), | ||
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) | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import '../BaseTest.sol'; | ||
|
||
import {CLRatePriceCapAdapter} from '../../src/contracts/CLRatePriceCapAdapter.sol'; | ||
import {CapAdaptersCodeZkSync} from '../../scripts/DeployZkSync.s.sol'; | ||
import {AaveV3ZkSync} from 'aave-address-book/AaveV3ZkSync.sol'; | ||
|
||
contract sUSDePriceCapAdapterZkSyncTest is BaseTest { | ||
constructor() | ||
BaseTest( | ||
CapAdaptersCodeZkSync.sUSDeAdapterCode(), | ||
8, | ||
ForkParams({network: 'zksync', blockNumber: 47910214}), | ||
'sUSDe_ZkSync' | ||
) | ||
{} | ||
|
||
function _createAdapter( | ||
IPriceCapAdapter.CapAdapterParams memory capAdapterParams | ||
) internal override returns (IPriceCapAdapter) { | ||
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 | ||
}) | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import '../BaseTest.sol'; | ||
|
||
import {CLRatePriceCapAdapter} from '../../src/contracts/CLRatePriceCapAdapter.sol'; | ||
import {CapAdaptersCodeZkSync} from '../../scripts/DeployZkSync.s.sol'; | ||
import {AaveV3ZkSync, AaveV3ZkSyncAssets} from 'aave-address-book/AaveV3ZkSync.sol'; | ||
|
||
contract weETHPriceCapAdapterZkSyncTest is BaseTest { | ||
constructor() | ||
BaseTest( | ||
CapAdaptersCodeZkSync.weETHAdapterCode(), | ||
8, | ||
ForkParams({network: 'zksync', blockNumber: 47840214}), | ||
'weETH_ZkSync' | ||
) | ||
{} | ||
|
||
function _createAdapter( | ||
IPriceCapAdapter.CapAdapterParams memory capAdapterParams | ||
) internal override returns (IPriceCapAdapter) { | ||
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 | ||
}) | ||
}); | ||
} | ||
} |