首页 > 解决方案 > 使用 Solidity 中的 hexdata 从已部署的合约 abc 调用已部署的合约 xyz 公共应付款功能

问题描述

在地址为 abc 的已部署合同中,我有:

        function CallContract(address tosend,uint amount,bytes hexdata,uint zgas) public payable {
               tosend.call.gas(zgas).value(amount)(hexdata);
        }

在 web3 我有

            await AbcContract.methods
           .CallContract(this.state.tosend,amounttowei,web3.utils.fromAscii(data),gas)
           .send({
             from:accounts[0]
           });

在地址为 XYZ 的已部署合同中,我有:

               uint public some var;
               uint public another var;

           function DoSomething() public payable {
               uint somevar = 1;
           }

           function DoSomethingAgain(uint justanumber) public payble {
               uint anothervar = justanumber;
           }

我究竟做错了什么?在 etherscan 我得到“虽然发生了一个或多个错误 [Out of gas] 合同执行已完成”

标签: blockchainethereumsolidityweb3smartcontracts

解决方案


推荐阅读