From 7408736abd8a7a2936cb74814766277beb2e7edb Mon Sep 17 00:00:00 2001 From: "A.L" Date: Mon, 19 Jun 2023 20:01:21 +0200 Subject: [PATCH] script: set asset manager for a given pair --- script/SetAssetManagerForPair.s.sol | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 script/SetAssetManagerForPair.s.sol diff --git a/script/SetAssetManagerForPair.s.sol b/script/SetAssetManagerForPair.s.sol new file mode 100644 index 00000000..62eca674 --- /dev/null +++ b/script/SetAssetManagerForPair.s.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.0; + +import "forge-std/Script.sol"; + +import { ReservoirDeployer, GenericFactory } from "src/ReservoirDeployer.sol"; +import { AaveManager, IAssetManagedPair} from "src/asset-management/AaveManager.sol"; + +contract SetAssetManagerForPair is Script { + + ReservoirDeployer internal _deployer = ReservoirDeployer(0xe5f6124f51D61C3b7C4D689768B1c55975b1c0F4); + AaveManager internal _assetManager = AaveManager(0x55231617f7E260358022534DB5114F671A3254B1); + + function run() external { + _setManagerForPair(IAssetManagedPair(0x55231617f7E260358022534DB5114F671A3254B1)); + } + + function _setManagerForPair(IAssetManagedPair aPair) internal { + vm.startBroadcast(); + GenericFactory lFactory = _deployer.factory(); + + bytes memory lCalldataForFactory = abi.encodeCall(IAssetManagedPair.setManager, (_assetManager)); + bytes memory lCalldataForDeployer = abi.encodeCall(lFactory.rawCall, (address(aPair) , lCalldataForFactory, 0)); + _deployer.rawCall(address(lFactory), lCalldataForDeployer, 0); + + vm.stopBroadcast(); + + require(aPair.assetManager() == _assetManager, "MANAGER_NOT_SET_CORRECTLY"); + } +}