PatrickAlphaC / ethers-simple-storage-fcc

90 stars 128 forks source link

The contract is deployed but also giving an error simulaneously #108

Open RohitGhosh7703 opened 11 months ago

RohitGhosh7703 commented 11 months ago

Here is the error

Error: processing response error (body="{\"id\":51,\"jsonrpc\":\"2.0\",\"error\":{\"message\":\"VM Exception while processing transaction: invalid opcode\",\"stack\":\"RuntimeError: VM Exception while processing transaction: invalid opcode\n at EIP1559FeeMarketTransaction.fillFromResult (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:12745)\n at Miner. (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:36703)\n at async Miner. (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:35116)\n at async Miner.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:39680)\n at async Blockchain.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:60063)\n at async Promise.all (index 0)\n at async TransactionPool.emit (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\node_modules\\emittery\\index.js:303:3)\",\"code\":-32000,\"name\":\"RuntimeError\",\"data\":{\"hash\":\"0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c\",\"programCounter\":24,\"result\":\"0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c\",\"reason\":null,\"message\":\"invalid opcode\"}}}", error={"code":-32000,"data":{"hash":"0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c","programCounter":24,"result":"0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c","reason":null,"message":"invalid opcode"}}, requestBody="{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0x02f9096a820539088459682f0084a1eb2d20831e84808080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220f4b414645914b4b5d4a3df7827cf9161cb1aa663635cbf0c61f92267c4b0a9a864736f6c63430008170033c001a0187ed94ff46cd718e7e8ace684b7b40e0d868996470f56aea1955a9361366ab2a063864276e8e374ea6ca54d1c0f3a02307b128ee56a02107c804dd8bc371bf545\"],\"id\":51,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="HTTP://127.0.0.1:7545", code=SERVER_ERROR, version=web/5.7.1) at Logger.makeError (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\logger\lib\index.js:238:21) at Logger.throwError (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\logger\lib\index.js:247:20) at C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:313:32 at step (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:33:23) at Object.next (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:14:53) at fulfilled (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { reason: 'processing response error', code: 'SERVER_ERROR', body: '{"id":51,"jsonrpc":"2.0","error":{"message":"VM Exception while processing transaction: invalid opcode","stack":"RuntimeError: VM Exception while processing transaction: invalid opcode\n at EIP1559FeeMarketTransaction.fillFromResult (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:12745)\n at Miner. (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:36703)\n at async Miner. (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:35116)\n at async Miner.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:39680)\n at async Blockchain.mine (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64__rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\1.js:2:60063)\n at async Promise.all (index 0)\n at async TransactionPool.emit (C:\\Program Files\\WindowsApps\\GanacheUI_2.7.1.0_x64rb4352f0jd4m2\\app\\resources\\static\\node\\node_modules\\ganache\\node_modules\\emittery\\index.js:303:3)","code":-32000,"name":"RuntimeError","data":{"hash":"0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c","programCounter":24,"result":"0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c","reason":null,"message":"invalid opcode"}}}', error: Error: VM Exception while processing transaction: invalid opcode at getResult (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\providers\lib\json-rpc-provider.js:191:21) at processJsonFunc (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:356:22) at C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:288:46 at step (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:33:23) at Object.next (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:14:53) at fulfilled (C:\Users\rg605\Desktop\Learning\WEB3\FreeCodecamp\ethers-simple-storage\node_modules\@ethersproject\web\lib\index.js:5:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: -32000, data: { hash: '0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c', programCounter: 24, result: '0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c', reason: null, message: 'invalid opcode' } }, requestBody: '{"method":"eth_sendRawTransaction","params":["0x02f9096a820539088459682f0084a1eb2d20831e84808080b9090f608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220f4b414645914b4b5d4a3df7827cf9161cb1aa663635cbf0c61f92267c4b0a9a864736f6c63430008170033c001a0187ed94ff46cd718e7e8ace684b7b40e0d868996470f56aea1955a9361366ab2a063864276e8e374ea6ca54d1c0f3a02307b128ee56a02107c804dd8bc371bf545"],"id":51,"jsonrpc":"2.0"}', requestMethod: 'POST', url: 'HTTP://127.0.0.1:7545', transaction: { type: 2, chainId: 1337, nonce: 8, maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true }, maxFeePerGas: BigNumber { _hex: '0xa1eb2d20', _isBigNumber: true }, gasPrice: null, gasLimit: BigNumber { _hex: '0x1e8480', _isBigNumber: true }, to: null, value: BigNumber { _hex: '0x00', _isBigNumber: true }, data: '0x608060405234801561000f575f80fd5b506108f28061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80632e64cec1146100595780636057361d146100775780636f760f41146100935780638bab8dd5146100af5780639e7a13ad146100df575b5f80fd5b610061610110565b60405161006e919061029f565b60405180910390f35b610091600480360381019061008c91906102f3565b610118565b005b6100ad60048036038101906100a8919061045a565b610121565b005b6100c960048036038101906100c491906104b4565b6101a5565b6040516100d6919061029f565b60405180910390f35b6100f960048036038101906100f491906102f3565b6101d2565b604051610107929190610575565b60405180910390f35b5f8054905090565b805f8190555050565b6001604051806040016040528083815260200184815250908060018154018082558091505060019003905f5260205f2090600202015f909190919091505f820151815f0155602082015181600101908161017b919061079d565b5050508060028360405161018f91906108a6565b9081526020016040518091039020819055505050565b6002818051602081018201805184825260208301602085012081835280955050505050505f915090505481565b600181815481106101e1575f80fd5b905f5260205f2090600202015f91509050805f015490806001018054610206906105d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610232906105d0565b801561027d5780601f106102545761010080835404028352916020019161027d565b820191905f5260205f20905b81548152906001019060200180831161026057829003601f168201915b5050505050905082565b5f819050919050565b61029981610287565b82525050565b5f6020820190506102b25f830184610290565b92915050565b5f604051905090565b5f80fd5b5f80fd5b6102d281610287565b81146102dc575f80fd5b50565b5f813590506102ed816102c9565b92915050565b5f60208284031215610308576103076102c1565b5b5f610315848285016102df565b91505092915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61036c82610326565b810181811067ffffffffffffffff8211171561038b5761038a610336565b5b80604052505050565b5f61039d6102b8565b90506103a98282610363565b919050565b5f67ffffffffffffffff8211156103c8576103c7610336565b5b6103d182610326565b9050602081019050919050565b828183375f83830152505050565b5f6103fe6103f9846103ae565b610394565b90508281526020810184848401111561041a57610419610322565b5b6104258482856103de565b509392505050565b5f82601f8301126104415761044061031e565b5b81356104518482602086016103ec565b91505092915050565b5f80604083850312156104705761046f6102c1565b5b5f83013567ffffffffffffffff81111561048d5761048c6102c5565b5b6104998582860161042d565b92505060206104aa858286016102df565b9150509250929050565b5f602082840312156104c9576104c86102c1565b5b5f82013567ffffffffffffffff8111156104e6576104e56102c5565b5b6104f28482850161042d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610532578082015181840152602081019050610517565b5f8484015250505050565b5f610547826104fb565b6105518185610505565b9350610561818560208601610515565b61056a81610326565b840191505092915050565b5f6040820190506105885f830185610290565b818103602083015261059a818461053d565b90509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806105e757607f821691505b6020821081036105fa576105f96105a3565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261065c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610621565b6106668683610621565b95508019841693508086168417925050509392505050565b5f819050919050565b5f6106a161069c61069784610287565b61067e565b610287565b9050919050565b5f819050919050565b6106ba83610687565b6106ce6106c6826106a8565b84845461062d565b825550505050565b5f90565b6106e26106d6565b6106ed8184846106b1565b505050565b5b81811015610710576107055f826106da565b6001810190506106f3565b5050565b601f8211156107555761072681610600565b61072f84610612565b8101602085101561073e578190505b61075261074a85610612565b8301826106f2565b50505b505050565b5f82821c905092915050565b5f6107755f198460080261075a565b1980831691505092915050565b5f61078d8383610766565b9150826002028217905092915050565b6107a6826104fb565b67ffffffffffffffff8111156107bf576107be610336565b5b6107c982546105d0565b6107d4828285610714565b5f60209050601f831160018114610805575f84156107f3578287015190505b6107fd8582610782565b865550610864565b601f19841661081386610600565b5f5b8281101561083a57848901518255600182019150602085019450602081019050610815565b868310156108575784890151610853601f891682610766565b8355505b6001600288020188555050505b505050505050565b5f81905092915050565b5f610880826104fb565b61088a818561086c565b935061089a818560208601610515565b80840191505092915050565b5f6108b18284610876565b91508190509291505056fea2646970667358221220f4b414645914b4b5d4a3df7827cf9161cb1aa663635cbf0c61f92267c4b0a9a864736f6c63430008170033', accessList: [], hash: '0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c', v: 1, r: '0x187ed94ff46cd718e7e8ace684b7b40e0d868996470f56aea1955a9361366ab2', s: '0x63864276e8e374ea6ca54d1c0f3a02307b128ee56a02107c804dd8bc371bf545', from: '0x8BB23312300007A4fE59401E3d87d4B866c2a772', confirmations: 0 }, transactionHash: '0xfa9b23fb297917f026ba1b4d83470b528ed17f23a85344756d01d5290e93da2c' }

TARishabh commented 10 months ago

hey? did you find any solution to this? here is my code, can you tell me where am i going wrong? I know this error is during deployment of the contract.

const ethers = require("ethers"); const fs = require("fs-extra");

async function main() {

const provider = new ethers.providers.JsonRpcProvider("HTTP://127.0.0.1:7545"); // saying hey we want to connect to this url.
// console.log(provider);
// now lets get the private keys and address,
const wallet = new ethers.Wallet(
    "0x980e8856975093bb103514dbe464d6f274cc1f03a30b8a9a18c4cb64b772ac66",
    provider
);

// console.log(wallet);

// now to interact with any contract we need 2 things as we know: Address and ABI
const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
// console.log(abi);
const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
);

const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
const overrides = { gasLimit: 6600000  }; 
const contract = await contractFactory.deploy(overrides);
// console.log(contract);
const deploymentReceipt = await contract.deployTransaction.wait(1); // wait for one more block to add in chain before confirmation of this block
const currentFavoriteNumber = await contract.retrieve();
console.log(currentFavoriteNumber);

}

main() .then(() => process.exit(0)) .catch((error) => { // console.log(error); process.exit(1);

anishwar-007 commented 9 months ago

Try this @RohitGhosh7703 I fixed this error by

Uninstall solc, then reinstall solc@0.8.7-fixed. Deleting both abi & bin files from your directory. Recompile the contract to generate abi & bin files.