contract FirstContract {
function createOtherContract() payable returns(address) {
// this function is payable. I want to take this
// value and use it when creating an instance of
// SecondContract
}
}
contract SecondContract {
function SecondContract() payable {
// SecondContract's constructor which is also payable
}
function acceptEther() payable {
// Some function which accepts ether
}
}
当用户单击网站上的按钮时,将从 js 应用程序创建 FirstContract。然后我想创建第二个合约的实例并将以太币传递给新合约。我无法弄清楚如何在发送以太币时从第一个合约中调用 SecondContract 的构造函数。