forked from bgd-labs/aave-v3-risk-stewards
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: collateral risk steward tests via configuration #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
yan-man
wants to merge
7
commits into
main
Choose a base branch
from
feat/1-collateral-risk-steward
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dd53d61
feat: collateral risk steward
yan-man 6568f6d
docs: natspec
yan-man 1948bd5
fix: deployment script, comment
yan-man f17e4db
feat: block actions thru config; tests
yan-man 55d8bad
test: resolve remaining, rm steward changes
yan-man cb3689f
fix: revert prior unneeded changes
yan-man d27558e
fix: pr comments
yan-man File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,107 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import 'solidity-utils/contracts/utils/ScriptUtils.sol'; | ||
| import {AaveV3Ethereum} from 'aave-address-book/AaveV3Ethereum.sol'; | ||
| import {RiskSteward, IRiskSteward} from '../../src/contracts/RiskSteward.sol'; | ||
|
|
||
| library DeployHorizonRiskStewards { | ||
| function _deployRiskStewards( | ||
| address pool, | ||
| address configEngine, | ||
| address riskCouncil, | ||
| address governance | ||
| ) internal returns (address) { | ||
| address riskSteward = address( | ||
| new RiskSteward(pool, configEngine, riskCouncil, governance, _getRiskConfig()) | ||
| ); | ||
| return riskSteward; | ||
| } | ||
|
|
||
| function _getRiskConfig() internal pure returns (IRiskSteward.Config memory) { | ||
| // only collateralConfig will be applied; other config changes will be reverted by the CollateralRiskSteward | ||
| return | ||
| IRiskSteward.Config({ | ||
| collateralConfig: IRiskSteward.CollateralConfig({ | ||
| ltv: IRiskSteward.RiskParamConfig({minDelay: 0, maxPercentChange: type(uint128).max}), | ||
| liquidationThreshold: IRiskSteward.RiskParamConfig({ | ||
| minDelay: 0, | ||
| maxPercentChange: type(uint128).max | ||
| }), | ||
| liquidationBonus: IRiskSteward.RiskParamConfig({ | ||
| minDelay: 0, | ||
| maxPercentChange: type(uint128).max | ||
| }), | ||
| debtCeiling: IRiskSteward.RiskParamConfig({ | ||
| minDelay: 0, | ||
| maxPercentChange: type(uint128).max | ||
| }) | ||
| }), | ||
| eModeConfig: IRiskSteward.EmodeConfig({ | ||
| ltv: IRiskSteward.RiskParamConfig({minDelay: type(uint40).max, maxPercentChange: 0}), | ||
| liquidationThreshold: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| liquidationBonus: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }) | ||
| }), | ||
| rateConfig: IRiskSteward.RateConfig({ | ||
| baseVariableBorrowRate: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| variableRateSlope1: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| variableRateSlope2: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| optimalUsageRatio: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }) | ||
| }), | ||
| capConfig: IRiskSteward.CapConfig({ | ||
| supplyCap: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| borrowCap: IRiskSteward.RiskParamConfig({minDelay: type(uint40).max, maxPercentChange: 0}) | ||
| }), | ||
| priceCapConfig: IRiskSteward.PriceCapConfig({ | ||
| priceCapLst: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| priceCapStable: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }), | ||
| discountRatePendle: IRiskSteward.RiskParamConfig({ | ||
| minDelay: type(uint40).max, | ||
| maxPercentChange: 0 | ||
| }) | ||
| }) | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| // make deploy-ledger contract=scripts/deploy/DeployHorizonStewards.s.sol:DeployEthereum chain=mainnet | ||
| // dry run: make deploy-pk contract=scripts/deploy/DeployHorizonStewards.s.sol:DeployEthereum chain=mainnet dry=1 | ||
| contract DeployEthereum is EthereumScript { | ||
| function run() external { | ||
| vm.startBroadcast(); | ||
| DeployHorizonRiskStewards._deployRiskStewards( | ||
| address(AaveV3Ethereum.POOL), | ||
| AaveV3Ethereum.CONFIG_ENGINE, | ||
| address(1), // TODO: advanced multisig | ||
| address(1) // TODO: advanced multisig | ||
miguelmtzinf marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ); | ||
| vm.stopBroadcast(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.