diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 7ae2b66b..530532e3 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -6,7 +6,7 @@ evm_version = 'shanghai' ignored_error_codes = [5574] # contract-size fs_permissions = [ { access = "read", path = "./utils/assets/" }, - { access = "write", path = "./deployment-manifest.json" } + { access = "read-write", path = "./deployment-manifest.json" } ] [invariant] diff --git a/contracts/src/scripts/OpenTroves.s.sol b/contracts/src/scripts/OpenTroves.s.sol index 560e1016..14c52dc3 100644 --- a/contracts/src/scripts/OpenTroves.s.sol +++ b/contracts/src/scripts/OpenTroves.s.sol @@ -71,10 +71,27 @@ contract OpenTroves is Script { function run() external { vm.startBroadcast(); - ICollateralRegistry collateralRegistry = ICollateralRegistry(vm.envAddress("COLLATERAL_REGISTRY")); + string memory manifestJson; + try vm.readFile("deployment-manifest.json") returns (string memory content) { + manifestJson = content; + } catch {} + + ICollateralRegistry collateralRegistry; + try vm.envAddress("COLLATERAL_REGISTRY") returns (address value) { + collateralRegistry = ICollateralRegistry(value); + } catch { + collateralRegistry = ICollateralRegistry(vm.parseJsonAddress(manifestJson, ".collateralRegistry")); + } vm.label(address(collateralRegistry), "CollateralRegistry"); - IHintHelpers hintHelpers = IHintHelpers(vm.envAddress("HINT_HELPERS")); + + IHintHelpers hintHelpers; + try vm.envAddress("HINT_HELPERS") returns (address value) { + hintHelpers = IHintHelpers(value); + } catch { + hintHelpers = IHintHelpers(vm.parseJsonAddress(manifestJson, ".hintHelpers")); + } vm.label(address(hintHelpers), "HintHelpers"); + address proxyImplementation = address(new Proxy()); vm.label(proxyImplementation, "ProxyImplementation"); diff --git a/contracts/src/scripts/RedeemCollateral.s.sol b/contracts/src/scripts/RedeemCollateral.s.sol index ded80845..25a46c18 100644 --- a/contracts/src/scripts/RedeemCollateral.s.sol +++ b/contracts/src/scripts/RedeemCollateral.s.sol @@ -16,8 +16,19 @@ contract RedeemCollateral is Script { function run() external { vm.startBroadcast(); - ICollateralRegistry collateralRegistry = ICollateralRegistry(vm.envAddress("COLLATERAL_REGISTRY")); + string memory manifestJson; + try vm.readFile("deployment-manifest.json") returns (string memory content) { + manifestJson = content; + } catch {} + + ICollateralRegistry collateralRegistry; + try vm.envAddress("COLLATERAL_REGISTRY") returns (address value) { + collateralRegistry = ICollateralRegistry(value); + } catch { + collateralRegistry = ICollateralRegistry(vm.parseJsonAddress(manifestJson, ".collateralRegistry")); + } vm.label(address(collateralRegistry), "CollateralRegistry"); + IBoldToken boldToken = IBoldToken(collateralRegistry.boldToken()); vm.label(address(boldToken), "BoldToken");