Skip to content

Commit

Permalink
Optimizations for zkSync transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
BastianMuc committed Mar 23, 2024
1 parent fb128bd commit 2c17141
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Platform/Client/web3Server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { current } = require('@reduxjs/toolkit')

exports.newWeb3Server = function newWeb3Server() {

const MODULE = "Web3 Server"
Expand Down Expand Up @@ -625,6 +627,12 @@ exports.newWeb3Server = function newWeb3Server() {

/* Default Gas Price for all chains but ETH */
let gasPrice = 5000000000
let gasLimit = 210000

if (chain === 'ZKS') {
gasPrice = 25000000
gasLimit = 500000
}

/* If executing on ETH, verify if current gas price is within reasonable range and calculate price for transaction */
if (chain === 'ETH') {
Expand Down Expand Up @@ -658,7 +666,7 @@ exports.newWeb3Server = function newWeb3Server() {
const rawTransaction = {
"from": fromAddress,
"gasPrice": web3.utils.toHex(gasPrice),
"gasLimit": web3.utils.toHex(210000),
"gasLimit": web3.utils.toHex(gasLimit),
"to": contractAddressDict[chain], "value": "0x0",
"data": contract.methods.transfer(toAddress, amountBigNumber).encodeABI(),
"nonce": web3.utils.toHex(nonce)
Expand Down

0 comments on commit 2c17141

Please sign in to comment.