Skip to content

Commit

Permalink
calldata better
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Jan 24, 2023
1 parent 4854cef commit 1e033cf
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 42 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVM.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMBridge.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMBridgeMock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMMock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions contracts/PolygonZkEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
* @param batches Struct array which the necessary data to append new batces ot the sequence
*/
function sequenceBatches(
BatchData[] memory batches
BatchData[] calldata batches
) external ifNotEmergencyState onlyTrustedSequencer {
uint256 batchesNum = batches.length;
require(
Expand Down Expand Up @@ -918,7 +918,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
* @param maticAmount Max amount of MATIC tokens that the sender is willing to pay
*/
function forceBatch(
bytes memory transactions,
bytes calldata transactions,
uint256 maticAmount
) external ifNotEmergencyState isForceBatchAllowed {
// Calculate matic collateral
Expand Down Expand Up @@ -970,7 +970,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
* @param batches Struct array which the necessary data to append new batces ot the sequence
*/
function sequenceForceBatches(
ForcedBatchData[] memory batches
ForcedBatchData[] calldata batches
) external ifNotEmergencyState isForceBatchAllowed {
uint256 batchesNum = batches.length;

Expand Down
14 changes: 7 additions & 7 deletions contracts/PolygonZkEVMBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ contract PolygonZkEVMBridge is
function bridgeMessage(
uint32 destinationNetwork,
address destinationAddress,
bytes memory metadata
bytes calldata metadata
) external payable ifNotEmergencyState {
require(
destinationNetwork != networkID,
Expand Down Expand Up @@ -280,7 +280,7 @@ contract PolygonZkEVMBridge is
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata
bytes calldata metadata
) external ifNotEmergencyState {
// Verify leaf exist and it does not have been claimed
_verifyLeaf(
Expand Down Expand Up @@ -394,7 +394,7 @@ contract PolygonZkEVMBridge is
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata
bytes calldata metadata
) external ifNotEmergencyState {
// Verify leaf exist and it does not have been claimed
_verifyLeaf(
Expand Down Expand Up @@ -445,7 +445,7 @@ contract PolygonZkEVMBridge is
string calldata name,
string calldata symbol,
uint8 decimals
) public view returns (address) {
) external view returns (address) {
bytes32 salt = keccak256(
abi.encodePacked(originNetwork, originTokenAddress)
);
Expand Down Expand Up @@ -476,7 +476,7 @@ contract PolygonZkEVMBridge is
function getTokenWrappedAddress(
uint32 originNetwork,
address originTokenAddress
) public view returns (address) {
) external view returns (address) {
return
tokenInfoToWrappedToken[
keccak256(abi.encodePacked(originNetwork, originTokenAddress))
Expand Down Expand Up @@ -523,7 +523,7 @@ contract PolygonZkEVMBridge is
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata,
bytes calldata metadata,
uint8 leafType
) internal {
// Set and check nullifier
Expand Down Expand Up @@ -577,7 +577,7 @@ contract PolygonZkEVMBridge is
* @notice Function to check if an index is claimed or not
* @param index Index
*/
function isClaimed(uint256 index) public view returns (bool) {
function isClaimed(uint256 index) external view returns (bool) {
(uint256 wordPos, uint256 bitPos) = _bitmapPositions(index);
uint256 mask = (1 << bitPos);
return (claimedBitMap[wordPos] & mask) == mask;
Expand Down
10 changes: 5 additions & 5 deletions contracts/interfaces/IPolygonZkEVMBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ interface IPolygonZkEVMBridge {
function bridgeMessage(
uint32 destinationNetwork,
address destinationAddress,
bytes memory metadata
bytes calldata metadata
) external payable;

function claimAsset(
bytes32[32] memory smtProof,
bytes32[32] calldata smtProof,
uint32 index,
bytes32 mainnetExitRoot,
bytes32 rollupExitRoot,
Expand All @@ -27,11 +27,11 @@ interface IPolygonZkEVMBridge {
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata
bytes calldata metadata
) external;

function claimMessage(
bytes32[32] memory smtProof,
bytes32[32] calldata smtProof,
uint32 index,
bytes32 mainnetExitRoot,
bytes32 rollupExitRoot,
Expand All @@ -40,7 +40,7 @@ interface IPolygonZkEVMBridge {
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata
bytes calldata metadata
) external;

function activateEmergencyState() external;
Expand Down
6 changes: 3 additions & 3 deletions docs/PolygonZkEVMBridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Verify merkle proof and execute message
string name,
string symbol,
uint8 decimals
) public returns (address)
) external returns (address)
```
Returns the precalculated address of a wrapper using the token information

Expand All @@ -151,7 +151,7 @@ Returns the precalculated address of a wrapper using the token information
function getTokenWrappedAddress(
uint32 originNetwork,
address originTokenAddress
) public returns (address)
) external returns (address)
```
Returns the address of a wrapper using the token information if already exist

Expand Down Expand Up @@ -220,7 +220,7 @@ Verify leaf and checks that it has not been claimed
```solidity
function isClaimed(
uint256 index
) public returns (bool)
) external returns (bool)
```
Function to check if an index is claimed or not

Expand Down
Loading

0 comments on commit 1e033cf

Please sign in to comment.