Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo committed Nov 28, 2023
1 parent 1b1010f commit eb95673
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 27 deletions.
3 changes: 1 addition & 2 deletions contracts/ForkableBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ contract ForkableBridge is
// tokens to the children-bridge contracts
address internal _hardAssetManager;


// @inheritdoc IForkableBridge
function initialize(
address _forkmanager,
Expand Down Expand Up @@ -132,7 +131,7 @@ contract ForkableBridge is
uint256 amount,
bool mintSecondChildAsWell
) public onlyAfterForking {
BridgeAssetOperations.splitTokenIntoChildToken(
BridgeAssetOperations.splitTokenIntoChildToken(
token,
amount,
children[0],
Expand Down
23 changes: 14 additions & 9 deletions contracts/ForkingManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();

Expand Down
18 changes: 4 additions & 14 deletions contracts/lib/BridgeAssetOperations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,18 @@ library BridgeAssetOperations {
);
}

// @inheritdoc IForkableBridge
// @inheritdoc IForkableBridge
function splitTokenIntoChildToken(
address token,
uint256 amount,
address child1,
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);
}
}

Expand Down
2 changes: 0 additions & 2 deletions test/ForkableBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit eb95673

Please sign in to comment.