【发布时间】:2019-06-16 15:14:00
【问题描述】:
我使用的是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;
}
【问题讨论】:
标签: blockchain ethereum solidity smartcontracts remix