-
Notifications
You must be signed in to change notification settings - Fork 2
[WIP] feat: init impl for AssetListingStewards scripts/tests #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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ broadcast/ | |
| .DS_Store | ||
| /input.json | ||
| zkout/ | ||
| reports/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| [submodule "lib/adi-deploy"] | ||
| path = lib/adi-deploy | ||
| url = https://github.com/bgd-labs/adi-deploy | ||
| [submodule "lib/aave-v3-horizon.git"] | ||
| path = lib/aave-v3-horizon.git | ||
| url = https://github.com/aave/aave-v3-horizon.git |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {console2 as console} from 'forge-std/console2.sol'; | ||
|
|
||
| import 'forge-std/Script.sol'; | ||
| import {PermissionedPayloadsController, PayloadsControllerUtils, IPayloadsControllerCore} from '../src/contracts/payloads/PermissionedPayloadsController.sol'; | ||
| import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol'; | ||
| import {Constants} from './GovBaseScript.sol'; | ||
| import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol'; | ||
| import {HorizonAddresses} from './Payloads/Horizon/HorizonAddresses.sol'; | ||
|
|
||
| contract Deploy_HorizonPermissionedPayloadsController is Script { | ||
| uint40 public constant DELAY = 1 days; // MIN_DELAY | ||
|
|
||
| function run(address proxyFactory) public { | ||
| vm.startBroadcast(); | ||
| _execute(proxyFactory); | ||
| vm.stopBroadcast(); | ||
| } | ||
|
|
||
| function GUARDIAN() public virtual returns (address) { | ||
| return HorizonAddresses.HORIZON_ADVANCED_MULTISIG; | ||
| } | ||
| function PAYLOADS_MANAGER() public virtual returns (address) { | ||
| return HorizonAddresses.HORIZON_ADVANCED_MULTISIG; | ||
| } | ||
| function PERMISSIONED_EXECUTOR() public virtual returns (address) { | ||
| return HorizonAddresses.EXECUTOR; | ||
| } | ||
|
Comment on lines
+22
to
+30
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are they public? i think these can be internal, or completely removed |
||
|
|
||
| function _getUpdateExecutorInput() | ||
| internal | ||
| returns (IPayloadsControllerCore.UpdateExecutorInput memory) | ||
| { | ||
| IPayloadsControllerCore.UpdateExecutorInput | ||
| memory updateExecutorInput = IPayloadsControllerCore.UpdateExecutorInput({ | ||
| accessLevel: PayloadsControllerUtils.AccessControl.Level_1, | ||
| executorConfig: IPayloadsControllerCore.ExecutorConfig({ | ||
| executor: PERMISSIONED_EXECUTOR(), | ||
| delay: DELAY | ||
| }) | ||
| }); | ||
| return updateExecutorInput; | ||
| } | ||
|
|
||
| function _execute(address proxyFactory) internal returns (address) { | ||
| address permissionedPayloadsControllerImpl = address( | ||
| new PermissionedPayloadsController() | ||
| ); | ||
| IPayloadsControllerCore.UpdateExecutorInput[] | ||
| memory executors = new IPayloadsControllerCore.UpdateExecutorInput[](1); | ||
| executors[0] = _getUpdateExecutorInput(); | ||
|
|
||
| address permissionedPayloadsController = TransparentProxyFactory( | ||
| proxyFactory | ||
| ).createDeterministic( | ||
| permissionedPayloadsControllerImpl, | ||
| PERMISSIONED_EXECUTOR(), // owner of proxy that will be deployed | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to deploy a proxy admin contract. This proxy factory does not do it, but other versions do |
||
| abi.encodeWithSelector( | ||
| PermissionedPayloadsController.initialize.selector, | ||
| GUARDIAN(), | ||
| PAYLOADS_MANAGER(), | ||
| executors | ||
| ), | ||
| Constants.PERMISSIONED_PAYLOADS_CONTROLLER_SALT | ||
| ); | ||
|
|
||
| return permissionedPayloadsController; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| library HorizonAddresses { | ||
| address public constant HORIZON_ADVANCED_MULTISIG = | ||
| 0x4444dE8a4AA3401a3AEC584de87B0f21E3e601CA; // Horizon Advanced Multisig | ||
| address public constant EXECUTOR = 0xf046907a4371F7F027113bf751F3347459a08b71; // Executor for Horizon | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {console2 as console} from 'forge-std/console2.sol'; | ||
|
|
||
| import {ACLManager} from 'lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/configuration/ACLManager.sol'; | ||
| import {IPoolConfigurator} from 'lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolConfigurator.sol'; | ||
| import {IAaveV3ConfigEngine as IEngine} from 'lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol'; | ||
| import {EngineFlags} from 'lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/EngineFlags.sol'; | ||
| import {AaveV3Payload} from 'lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol'; | ||
|
|
||
| contract HorizonAssetListing is AaveV3Payload { | ||
| bytes32 public constant RISK_ADMIN_ROLE = keccak256('RISK_ADMIN'); | ||
| bytes32 public constant ASSET_LISTING_ADMIN_ROLE = | ||
| keccak256('ASSET_LISTING_ADMIN'); | ||
|
|
||
| address public constant ATOKEN_IMPLEMENTATION = | ||
| 0xa592C7900fDD6fb4019a93E50DF3fE664b569151; // Horizon PROD vtestnet | ||
| address public constant RWA_ATOKEN_IMPLEMENTATION = | ||
| 0x8941D6c373ff55a5a5615920CEF589FA4c200277; // Horizon PROD vtestnet | ||
| address public constant VARIABLE_DEBT_TOKEN_IMPLEMENTATION = | ||
| 0x2096537dbFF6E0950d68c41927091e303ecC1579; // Horizon PROD vtestnet | ||
| address public constant ACL_MANAGER = | ||
| 0x9Cfbd85499cb3c8d58AA2B186A3865071A1fa963; // Horizon PROD vtestnet | ||
|
|
||
| address public constant ASSET_ADDRESS = | ||
| 0x7712c34205737192402172409a8F7ccef8aA2AEc; // BUIDL | ||
| address public constant ASSET_PRICE_FEED = | ||
| 0xb9BD795BB71012c0F3cd1D9c9A4c686F2d3524A4; // BUIDL | ||
| string public constant ASSET_SYMBOL = 'BUIDL'; | ||
|
|
||
| constructor(address configEngine) AaveV3Payload(IEngine(configEngine)) {} | ||
|
|
||
| // new custom asset listing | ||
| function newListingsCustom() | ||
| public | ||
| view | ||
| override | ||
| returns (IEngine.ListingWithCustomImpl[] memory) | ||
| { | ||
| IEngine.ListingWithCustomImpl[] | ||
| memory listingsCustom = new IEngine.ListingWithCustomImpl[](1); | ||
|
|
||
| listingsCustom[0] = IEngine.ListingWithCustomImpl( | ||
| IEngine.Listing({ | ||
| asset: ASSET_ADDRESS, | ||
| assetSymbol: ASSET_SYMBOL, | ||
| priceFeed: ASSET_PRICE_FEED, | ||
| rateStrategyParams: IEngine.InterestRateInputData({ | ||
| optimalUsageRatio: 92_50, | ||
| baseVariableBorrowRate: 0, | ||
| variableRateSlope1: 5_50, | ||
| variableRateSlope2: 35_00 | ||
| }), | ||
| enabledToBorrow: EngineFlags.DISABLED, | ||
| borrowableInIsolation: EngineFlags.DISABLED, | ||
| withSiloedBorrowing: EngineFlags.DISABLED, | ||
| flashloanable: EngineFlags.DISABLED, | ||
| ltv: 75_00, | ||
| liqThreshold: 80_00, | ||
| liqBonus: 12_00, | ||
| reserveFactor: 15_00, | ||
| supplyCap: 5_000_000, | ||
| borrowCap: 0, | ||
| debtCeiling: 0, | ||
| liqProtocolFee: 0 | ||
| }), | ||
| IEngine.TokenImplementations({ | ||
| aToken: ATOKEN_IMPLEMENTATION, | ||
| vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION | ||
| }) | ||
| ); | ||
|
|
||
| return listingsCustom; | ||
| } | ||
|
|
||
| function getPoolContext() | ||
| public | ||
| pure | ||
| override | ||
| returns (IEngine.PoolContext memory) | ||
| { | ||
| return | ||
| IEngine.PoolContext({ | ||
| networkName: 'Horizon RWA', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need Aave here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'll double check and match w whatever Alex has for phase1 |
||
| networkAbbreviation: 'HorRwa' | ||
| }); | ||
| } | ||
|
|
||
| // optional | ||
| function _postExecute() internal override { | ||
| ACLManager(ACL_MANAGER).renounceRole(RISK_ADMIN_ROLE, address(this)); | ||
| ACLManager(ACL_MANAGER).renounceRole( | ||
|
Comment on lines
+92
to
+93
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be removed |
||
| ASSET_LISTING_ADMIN_ROLE, | ||
| address(this) | ||
| ); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can set the proxy factory to use in a constant