Skip to content

Commit

Permalink
update package json
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Jan 25, 2024
1 parent c1c4f6d commit eda2d5c
Show file tree
Hide file tree
Showing 5 changed files with 791 additions and 316 deletions.
22 changes: 22 additions & 0 deletions contracts/PolygonZkEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,28 @@ contract PolygonZkEVM is
_activateEmergencyState();
}

/**
* @notice Function to deactivate emergency state on both PolygonZkEVM and PolygonZkEVMBridge contracts
*/
function deactivateEmergencyState() external onlyAdmin {
// Deactivate emergency state on PolygonZkEVMBridge
bridgeAddress.deactivateEmergencyState();

// Deactivate emergency state on this contract
super._deactivateEmergencyState();
}

/**
* @notice Internal function to activate emergency state on both PolygonZkEVM and PolygonZkEVMBridge contracts
*/
function _activateEmergencyState() internal override {
// Activate emergency state on PolygonZkEVM Bridge
bridgeAddress.activateEmergencyState();

// Activate emergency state on this contract
super._activateEmergencyState();
}

////////////////////////
// public/view functions
////////////////////////
Expand Down
27 changes: 0 additions & 27 deletions contracts/lib/DepositContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,33 +117,6 @@ contract DepositContract is ReentrancyGuardUpgradeable {
return node == root;
}

/**
* @notice calcualte root from merkle proof
* @param leafHash Leaf hash
* @param smtProof Smt proof
* @param index Index of the leaf
*/
function calculateRoot(
bytes32 leafHash,
bytes32[_DEPOSIT_CONTRACT_TREE_DEPTH] calldata smtProof,
uint32 index
) public pure returns (bytes32) {
bytes32 node = leafHash;

// Check merkle proof
for (
uint256 height = 0;
height < _DEPOSIT_CONTRACT_TREE_DEPTH;
height++
) {
if (((index >> height) & 1) == 1)
node = keccak256(abi.encodePacked(smtProof[height], node));
else node = keccak256(abi.encodePacked(node, smtProof[height]));
}

return node;
}

/**
* @notice Given the leaf data returns the leaf value
* @param leafType Leaf type --> [0] transfer Ether / ERC20 tokens, [1] message
Expand Down
12 changes: 12 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = {
runs: 999999,
},
},

},
{
version: '0.5.16',
Expand All @@ -73,6 +74,17 @@ module.exports = {
enabled: true,
runs: 99,
},
evmVersion: "shanghai",
},// try yul optimizer
},
"contracts/v2/L2/PolygonZkEVMBridgeL2.sol": {
version: '0.8.20',
settings: {
optimizer: {
enabled: true,
runs: 9999,
},
evmVersion: "shanghai",
},
}
}
Expand Down
Loading

0 comments on commit eda2d5c

Please sign in to comment.