Skip to content

Commit

Permalink
Change to call of get admin
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Nov 14, 2024
1 parent 43b788e commit 9c148cc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions l1-contracts/contracts/chain-registrar/ChainRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ contract ChainRegistrar is Ownable2StepUpgradeable, ReentrancyGuard {
mapping(bytes32 => ChainConfig) public proposedChains;

error ProposalNotFound();
error BaseTokenTransferFailed();
error ChainIsAlreadyDeployed();
error ChainIsNotYetDeployed();
error BridgeIsNotRegistered();
Expand Down Expand Up @@ -105,7 +106,10 @@ contract ChainRegistrar is Ownable2StepUpgradeable, ReentrancyGuard {
uint256 amount = (1 ether * config.baseToken.gasPriceMultiplierNominator) /
config.baseToken.gasPriceMultiplierDenominator;
if (IERC20(config.baseToken.tokenAddress).balanceOf(address(this)) < amount) {
IERC20(config.baseToken.tokenAddress).transferFrom(msg.sender, l2Deployer, amount);
bool success = IERC20(config.baseToken.tokenAddress).transferFrom(msg.sender, l2Deployer, amount);
if (!success) {
revert BaseTokenTransferFailed();
}
}
}
emit NewChainRegistrationProposal(config.chainId, msg.sender, key);
Expand Down Expand Up @@ -136,9 +140,10 @@ contract ChainRegistrar is Ownable2StepUpgradeable, ReentrancyGuard {
revert ChainIsNotYetDeployed();
}
address diamondProxy = IStateTransitionManager(stm).getHyperchain(chainId);
(bool success, bytes memory returnData) = diamondProxy.call(abi.encodeWithSelector(IGetters.getAdmin.selector));
require(success);
address chainAdmin = bytesToAddress(returnData);
// (bool success, bytes memory returnData) = diamondProxy.call(abi.encodeWithSelector(IGetters.getAdmin.selector));
// require(success);
// address chainAdmin = bytesToAddress(returnData);
address chainAdmin = IGetters(diamondProxy).getAdmin();
address l2BridgeAddress = bridgehub.sharedBridge().l2BridgeAddress(chainId);
if (l2BridgeAddress == address(0)) {
revert BridgeIsNotRegistered();
Expand Down

0 comments on commit 9c148cc

Please sign in to comment.