我有一个智能合约,看起来像这样。
pragma solidity >=0.4.24;
contract Issue {
uint public threshold = 0;
address public partyA;
address public partyB;
bytes public issueHash;
// issue can only be created once and non - mutable, hence this function
function Issuecreate(address _addressB, bytes memory _issueHash) public {
if (threshold != 0){
revert("Issue can only be created once");
}
partyA = msg.sender;
partyB = _addressB;
issueHash = _issueHash;
threshold = 1;
}
// .....more contract here
}
contract issueFactory{
address[] public contracts;
// contract counter
function getContractCount()
public
view
returns(uint contractCount)
{
return contracts.length;
}
// deploy a new contract
function newIssue() //of course parameters would go here
public
returns(address newContract)
{
Issue c = new Issue(); //HERE, I would like to create a new issue contract here but also calling the function issue create from within that contract. Is this possible?
contracts.push(address(c));
return address(c);
}
}
现在,实际上,我想使用该合同工厂创建一个新的智能合同,但是为了节省汽油成本,我希望部署该合同,并且已经在合同部署中填充了一些信息。
所以,可以说我创建了一个签发合同,我想要保存地址,签发哈希以及所有这些东西。这些东西永远不会改变,因此写在合同部署上是很实际的。
是否可以使用某种命令来部署合同,同时还要使用该功能。
例如某些伪代码,例如IssueFactory.newIssue.issueCreate(x,x);
我还将在前端使用Web3,所以如果我不能直接在合同上写,也许我可以在那做。