diff --git a/contracts/ForkableBridge.sol b/contracts/ForkableBridge.sol index 99d79b0b..16849419 100644 --- a/contracts/ForkableBridge.sol +++ b/contracts/ForkableBridge.sol @@ -19,7 +19,6 @@ contract ForkableBridge is // tokens to the children-bridge contracts address internal _hardAssetManager; - // @inheritdoc IForkableBridge function initialize( address _forkmanager, @@ -132,7 +131,7 @@ contract ForkableBridge is uint256 amount, bool mintSecondChildAsWell ) public onlyAfterForking { - BridgeAssetOperations.splitTokenIntoChildToken( + BridgeAssetOperations.splitTokenIntoChildToken( token, amount, children[0], diff --git a/contracts/ForkingManager.sol b/contracts/ForkingManager.sol index c5d03b62..769f50e9 100644 --- a/contracts/ForkingManager.sol +++ b/contracts/ForkingManager.sol @@ -114,9 +114,15 @@ contract ForkingManager is IForkingManager, ForkableStructure { // Create the children of each contract NewInstances memory newInstances; - (newInstances.forkingManager.one, ) = _createChildren(newImplementations.forkingManagerImplementation); - (newInstances.bridge.one, ) = IForkableBridge(bridge).createChildren(newImplementations.bridgeImplementation); - (newInstances.zkEVM.one, ) = IForkableZkEVM(zkEVM).createChildren(newImplementations.zkEVMImplementation); + (newInstances.forkingManager.one, ) = _createChildren( + newImplementations.forkingManagerImplementation + ); + (newInstances.bridge.one, ) = IForkableBridge(bridge).createChildren( + newImplementations.bridgeImplementation + ); + (newInstances.zkEVM.one, ) = IForkableZkEVM(zkEVM).createChildren( + newImplementations.zkEVMImplementation + ); (newInstances.forkonomicToken.one, ) = IForkonomicToken(forkonomicToken) .createChildren(newImplementations.forkonomicTokenImplementation); (newInstances.globalExitRoot.one, ) = IForkableGlobalExitRoot( @@ -225,13 +231,12 @@ contract ForkingManager is IForkingManager, ForkableStructure { // Create the children of each contract NewInstances memory newInstances; - (,newInstances.forkingManager.two) = getChildren(); - (,newInstances.bridge.two) = IForkableBridge(bridge).getChildren(); - (,newInstances.zkEVM.two) = IForkableZkEVM(zkEVM).getChildren( - ); - (,newInstances.forkonomicToken.two) = IForkonomicToken(forkonomicToken) + (, newInstances.forkingManager.two) = getChildren(); + (, newInstances.bridge.two) = IForkableBridge(bridge).getChildren(); + (, newInstances.zkEVM.two) = IForkableZkEVM(zkEVM).getChildren(); + (, newInstances.forkonomicToken.two) = IForkonomicToken(forkonomicToken) .getChildren(); - (,newInstances.globalExitRoot.two) = IForkableGlobalExitRoot( + (, newInstances.globalExitRoot.two) = IForkableGlobalExitRoot( globalExitRoot ).getChildren(); diff --git a/contracts/lib/BridgeAssetOperations.sol b/contracts/lib/BridgeAssetOperations.sol index aeb26de2..8cee5eb5 100644 --- a/contracts/lib/BridgeAssetOperations.sol +++ b/contracts/lib/BridgeAssetOperations.sol @@ -72,7 +72,7 @@ library BridgeAssetOperations { ); } - // @inheritdoc IForkableBridge + // @inheritdoc IForkableBridge function splitTokenIntoChildToken( address token, uint256 amount, @@ -80,20 +80,10 @@ library BridgeAssetOperations { address child2, PolygonZkEVMBridge.TokenInformation memory tokenInfo ) public { - TokenWrapped(token).burn(msg.sender, amount); - createChildToken( - token, - amount, - tokenInfo, - child1 - ); + TokenWrapped(token).burn(msg.sender, amount); + createChildToken(token, amount, tokenInfo, child1); if (child2 != address(0)) { - createChildToken( - token, - amount, - tokenInfo, - child2 - ); + createChildToken(token, amount, tokenInfo, child2); } } diff --git a/test/ForkableBridge.t.sol b/test/ForkableBridge.t.sol index e15651d8..aac23260 100644 --- a/test/ForkableBridge.t.sol +++ b/test/ForkableBridge.t.sol @@ -277,7 +277,6 @@ contract ForkableBridgeTest is Test { // Split the token forkableBridge.splitTokenIntoChildToken(forkableToken, amount, true); - // Assert token balances address forkableTokenChild1 = ForkableBridge(child1) .tokenInfoToWrappedToken(tokenInfoHash); @@ -360,7 +359,6 @@ contract ForkableBridgeTest is Test { // Split the token forkableBridge.splitTokenIntoChildToken(forkableToken, amount, true); - // Only parent can merge vm.expectRevert(bytes("onlyAfterForking")); ForkableBridge(child1).mergeChildTokens(forkableToken, amount + 1);