Ganache在部署合同后不更新帐户余额



我使用Ganache和nodeJS。每当我试图用JavaScript部署我的合约时,相关的区块就会被挖掘出来,这表明给定的合约被部署了,但发送方账户(或部署方账户)的余额不会被更新。我能看出这是怎么回事。

JavaScript代码:

const Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider(Web3.currentProvider));
.
.
.
const cid = <a value>;
const pid = <a value>;


const source2='path of my solidity file';
const compiledMyContract = solc.compile(source2);
const myContractJson="path of json version of my solidity file";
const myContractJs = JSON.parse(fs.readFileSync(myContractJson));
const contractByteCode="...";
const gasEstimate = await web3.eth.estimateGas({data: contractByteCode});
const myContract = new web3.eth.Contract(myContractJs.abi, null, {data: contractByteCode});
myContract.deploy().send({from:<address>, gas: gasEstimate, gasPrice: 
200}).then((instance) => {
console.log("Contract mined at " + instance.options.address);
instance.methods.function_A(cid, pid).send({
from:<address>,
gas: 2000000,
gasPrice: 200
});
.
.
.

我试着重新启动ganache,它工作了。

最新更新