Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ broadcast/
.DS_Store
/input.json
zkout/
reports/
3 changes: 3 additions & 0 deletions .gitmodules
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
1 change: 1 addition & 0 deletions lib/aave-v3-horizon.git
Submodule aave-v3-horizon.git added at 1ea92e
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ aave-helpers/=lib/adi-deploy/lib/aave-helpers/src/
aave-address-book/=lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/src/
aave-v3-origin/=lib/adi-deploy/lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/
adi-deploy/=lib/adi-deploy/
aave-v3-horizon/=lib/aave-v3-horizon.git/src/
71 changes: 71 additions & 0 deletions scripts/Deploy_HorizonPermissionedPayloadsController.s.sol
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);
Copy link
Collaborator

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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;
}
}
8 changes: 8 additions & 0 deletions scripts/Payloads/Horizon/HorizonAddresses.sol
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
}
98 changes: 98 additions & 0 deletions scripts/Payloads/Horizon/HorizonAssetListing.sol
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',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need Aave here? Aave Horizon RWA

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be removed

ASSET_LISTING_ADMIN_ROLE,
address(this)
);
}
}
Loading