我正在使用solidity 0.5.2版
pragma solidity ^0.5.2;
contract CampaignFactory{
address[] public deployedCampaigns;
function createCampaign(uint minimum) public{
address newCampaign = new Campaign(minimum,msg.sender); //Error
//here!!!
deployedCampaigns.push(newCampaign);
}
function getDeployedCampaigns() public view returns(address[] memory){
return deployedCampaigns;
}
}
我在分配调用 CampaignFactory 合同中的 Campaign 合同时遇到错误
TypeError: Type contract Campaign is not implicitly convertible to expected
type address.
address newCampaign = new Campaign(minimum,msg.sender);
我有另一个名为 Campaign 的合同,我想在 CampaignFactory 中访问它。
contract Campaign{
//some variable declarations and some codes here......
我有如下构造函数
constructor (uint minimum,address creator) public{
manager=creator;
minimumContribution=minimum;
}