Skip to content

Commit

Permalink
fix: [N-01] Constants not using UPPER_CASE format
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl committed Jul 25, 2023
1 parent e2767a1 commit 96c12ac
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions contracts/chain-adapters/ZkSync_Adapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ contract ZkSync_Adapter is AdapterInterface {
// goes live. For now, we'll hardcode these and use aggressive values to ensure inclusion.

// Limit on L2 gas to spend.
uint256 public constant l2GasLimit = 300_000;
uint256 public constant L2_GAS_LMIT = 300_000;

// How much gas is required to publish a byte of data from L1 to L2. 800 is the required value
// as set here https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L226
// Note, this value can change and will require an updated adapter.
uint256 public constant l1GasToL2GasPerPubDataLimit = 800;
uint256 public constant L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT = 800;

// This address receives any remaining fee after an L1 to L2 transaction completes.
// If refund recipient = address(0) then L2 msg.sender is used, unelss msg.sender is a contract then its address
// If refund recipient = address(0) then L2 msg.sender is used, unless msg.sender is a contract then its address
// gets aliased.
address public constant l2RefundAddress = 0x428AB2BA90Eba0a4Be7aF34C9Ac451ab061AC010;
address public constant L2_REFUND_ADDRESS = 0x428AB2BA90Eba0a4Be7aF34C9Ac451ab061AC010;

// Hardcode the following ZkSync system contract addresses to save gas on construction. This adapter can be
// redeployed in the event that the following addresses change.
Expand Down Expand Up @@ -122,10 +122,10 @@ contract ZkSync_Adapter is AdapterInterface {
// We pass no ETH with the call, otherwise we'd need to add to the txBaseCost this value.
0,
message,
l2GasLimit,
l1GasToL2GasPerPubDataLimit,
L2_GAS_LIMIT,
L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
new bytes[](0),
l2RefundAddress
L2_REFUND_ADDRESS
);

emit MessageRelayed(target, message);
Expand Down Expand Up @@ -168,20 +168,20 @@ contract ZkSync_Adapter is AdapterInterface {
to,
amount,
"",
l2GasLimit,
l1GasToL2GasPerPubDataLimit,
L2_GAS_LIMIT,
L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
new bytes[](0),
l2RefundAddress
L2_REFUND_ADDRESS
);
} else {
IERC20(l1Token).safeIncreaseAllowance(address(zkErc20Bridge), amount);
txHash = zkErc20Bridge.deposit{ value: txBaseCost }(
to,
l1Token,
amount,
l2GasLimit,
l1GasToL2GasPerPubDataLimit,
l2RefundAddress
L2_GAS_LIMIT,
L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT,
L2_REFUND_ADDRESS
);
}

Expand All @@ -199,7 +199,7 @@ contract ZkSync_Adapter is AdapterInterface {
// https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/ethereum/contracts/zksync/facets/Mailbox.sol#L273
// - priority_fee_per_gas = min(transaction.max_priority_fee_per_gas, transaction.max_fee_per_gas - block.base_fee_per_gas)
// - effective_gas_price = priority_fee_per_gas + block.base_fee_per_gas
return zkSync.l2TransactionBaseCost(tx.gasprice, l2GasLimit, l1GasToL2GasPerPubDataLimit);
return zkSync.l2TransactionBaseCost(tx.gasprice, L2_GAS_LIMIT, L1_GAS_TO_L2_GAS_PER_PUB_DATA_LIMIT);
}

function _contractHasSufficientEthBalance() internal view returns (uint256 requiredL1CallValue) {
Expand Down

0 comments on commit 96c12ac

Please sign in to comment.