Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.
Merged
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
867 changes: 446 additions & 421 deletions contracts/global/BytecodeRepository.sol

Large diffs are not rendered by default.

485 changes: 264 additions & 221 deletions contracts/global/CrossChainMultisig.sol

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions contracts/instance/InstanceManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ contract InstanceManager is Ownable, IInstanceManager {
? _getLegacyGearStakingAddress()
: _deploySystemContract(contractType_, version_);

if (newSystemContract != address(0)) _setAddress(contractType_, newSystemContract, saveVersion);
_setAddress(contractType_, newSystemContract, saveVersion);
}

/// @notice Allows cross-chain governance to set a global address in the address provider
Expand Down Expand Up @@ -203,15 +203,12 @@ contract InstanceManager is Ownable, IInstanceManager {
}

/// @dev Deploys a system contract and returns its address
function _deploySystemContract(bytes32 _contractType, uint256 _version) internal returns (address) {
try ProxyCall(crossChainGovernanceProxy).proxyCall(
function _deploySystemContract(bytes32 contractType_, uint256 version_) internal returns (address) {
bytes memory result = ProxyCall(crossChainGovernanceProxy).proxyCall(
address(bytecodeRepository),
abi.encodeCall(BytecodeRepository.deploy, (_contractType, _version, abi.encode(addressProvider), 0))
) returns (bytes memory result) {
return abi.decode(result, (address));
} catch {
return address(0);
}
abi.encodeCall(BytecodeRepository.deploy, (contractType_, version_, abi.encode(addressProvider), 0))
);
return abi.decode(result, (address));
}

/// @dev Whether there is a legacy instance on this chain
Expand All @@ -229,7 +226,8 @@ contract InstanceManager is Ownable, IInstanceManager {
return 0xe88846b6C85AA67688e453c7eaeeeb40F51e1F0a;
} else if (block.chainid == 42161) {
return 0xf3599BEfe8E79169Afd5f0b7eb0A1aA322F193D9;
} else {
revert();
}
return address(0);
}
}
12 changes: 5 additions & 7 deletions contracts/instance/PriceFeedStore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ contract PriceFeedStore is
/// @notice Executes price feed configuration `calls` with owner privileges
/// @dev Reverts if caller is not owner
/// @dev Reverts if any of call targets is not a known price feed
/// @dev Reverts if any of calls transfers or renounces ownership over price feed
/// @dev Reverts if any of calls renounces ownership over price feed
function configurePriceFeeds(Call[] calldata calls) external override onlyOwner {
uint256 numCalls = calls.length;
for (uint256 i; i < numCalls; ++i) {
if (!_knownPriceFeeds.contains(calls[i].target)) revert PriceFeedIsNotKnownException(calls[i].target);
bytes4 selector = bytes4(calls[i].callData);
if (selector == Ownable.transferOwnership.selector || selector == Ownable.renounceOwnership.selector) {
if (selector == Ownable.renounceOwnership.selector) {
revert ForbiddenConfigurationMethodException(selector);
}
calls[i].target.functionCall(calls[i].callData);
Expand Down Expand Up @@ -292,14 +292,12 @@ contract PriceFeedStore is

/// @dev Returns whether `priceFeed` is deployed externally or via BCR.
/// For latter case, also ensures that price feed is owned by the store.
function _validatePriceFeedDeployment(address priceFeed) internal view returns (bool) {
if (IBytecodeRepository(bytecodeRepository).deployedContracts(priceFeed) == 0) return true;
function _validatePriceFeedDeployment(address priceFeed) internal returns (bool) {
if (!IBytecodeRepository(bytecodeRepository).isDeployedFromRepository(priceFeed)) return true;

try Ownable2Step(priceFeed).acceptOwnership() {} catch {}
try Ownable(priceFeed).owner() returns (address owner_) {
if (owner_ != address(this)) revert PriceFeedIsNotOwnedByStore(priceFeed);
try Ownable2Step(priceFeed).pendingOwner() returns (address pendingOwner_) {
if (pendingOwner_ != address(0)) revert PriceFeedIsNotOwnedByStore(priceFeed);
} catch {}
} catch {}

return false;
Expand Down
Loading