Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const web3 = new Web3Shim({
provider: config.provider,
networkType: config.networks[config.network].type
});
const accounts = await web3.eth.getAccounts();
const block = await web3.eth.getBlock("latest");
const upstreamNetwork = config.network;
const upstreamConfig = config.networks[upstreamNetwork];
const forkedNetwork = config.network + "-fork";
config.networks[forkedNetwork] = {
network_id: config.network_id,
provider: Ganache.provider({
fork: config.provider,
unlocked_accounts: accounts,
gasLimit: block.gasLimit
}),
from: config.from,
gas: upstreamConfig.gas,
gasPrice: upstreamConfig.gasPrice
};
config.network = forkedNetwork;
},
const accounts = await web3.eth.getAccounts();
const block = await interfaceAdapter.getBlock("latest");
const upstreamNetwork = config.network;
const upstreamConfig = config.networks[upstreamNetwork];
const forkedNetwork = config.network + "-fork";
const ganacheOptions = {
fork: config.provider,
gasLimit: block.gasLimit
};
if (accounts.length > 0) ganacheOptions.unlocked_accounts = accounts;
config.networks[forkedNetwork] = {
network_id: config.network_id,
provider: Ganache.provider(ganacheOptions),
from: config.from,
gas: upstreamConfig.gas,
gasPrice: upstreamConfig.gasPrice
};
config.network = forkedNetwork;
},