1 Star 0 Fork 10

沧海辽望/crowFunding-eth

forked from duke.du/crowFunding-eth 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
FundingFactory.sol 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
pragma solidity ^0.4.24;
import './basicFunding.sol';
import './InvestorToFunding.sol';
contract FundingFactory {
address[] public crowFundingArray;
mapping(address => address[]) public creatorFundingMap;
address public platformProvider;
//添加一个变量,默认i2为0x00000000000000000,必须实例化才可使用
InvestorToFunding i2f;
constructor() public {
platformProvider = msg.sender;
//实例化InvestorToFunding合约,返回一个地址。
address i2fAddress = new InvestorToFunding();
//将地址显示转换为InvestorToFunding类型,此时i2可以正常使用了
i2f = InvestorToFunding(i2fAddress);
}
function createFunding(string _projectName, uint _supportMoney, uint _goalMoney, uint _duration) public {
//a. 创建一个新合约
address fundingAddress = new CrowFunding(_projectName, _supportMoney, _goalMoney, _duration, msg.sender, i2f);
//b. 添加到合约集合中
crowFundingArray.push(fundingAddress);
//c. 添加到我所创建合约的集合中
creatorFundingMap[msg.sender].push(fundingAddress);
}
//返回该众筹平台所有的合约
function getAllFunding() public view returns(address[]){
return crowFundingArray;
}
//返回当前账户所创建的所有合约
function getCreatorFunding() public view returns(address[]) {
return creatorFundingMap[msg.sender];
}
//返回当前账户所参加的所有合约
function getInvestorFunding() public view returns(address[]) {
return i2f.getFundingBy(msg.sender);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
NodeJS
1
https://gitee.com/lz1289/crowFunding-eth.git
git@gitee.com:lz1289/crowFunding-eth.git
lz1289
crowFunding-eth
crowFunding-eth
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385