Я не могу вызвать эту функцию. В чем проблема?
function SelectedObject(address _addr)public payable {
require(save[msg.sender]==0);
save[msg.sender]+=1;
apple memory yy;
yy.addr1 = _addr;
yy.money1 = msg.value;
testt[_addr][msg.sender]=test1[msg.sender];
test[msg.sender][test1[msg.sender]]=_addr;
pple[_addr][test1[msg.sender]]=apple(yy.addr1,yy.money1);
}
Это полный договор.
pragma solidity ^0.4.21;
contract Trust {
address owner= msg.sender;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
mapping(address => Depositordata[]) depositdata;
mapping(address => apple[]) pple;
mapping(address => uint8)save;
mapping(address => mapping(uint => address))test;
mapping(address => uint)test1;//陣列號碼
mapping(address => mapping(address =>uint))testt;
struct apple{
address addr1;
uint money1;
}
struct Depositordata{
uint oncemorney;
uint alltime;
uint starttime;
}
function SelectedObject(address _addr)public payable {
require(save[msg.sender]==0);
save[msg.sender]+=1;
apple memory yy;
yy.addr1 = _addr;
yy.money1 = msg.value;
testt[_addr][msg.sender]=test1[msg.sender];
test[msg.sender][test1[msg.sender]]=_addr;
pple[_addr][test1[msg.sender]]=apple(yy.addr1,yy.money1);
}
function receive(address msgsender)public{
Depositordata memory yyy;
apple memory yy;
require(yy.money1>=depositdata[msg.sender][testt[msg.sender][msgsender]].oncemorney);
require(yyy.starttime<now);
require(yyy.alltime>0);
msg.sender.transfer(yyy.oncemorney);
pple[msgsender][testt[msg.sender][msgsender]].money1-=yyy.oncemorney;
yyy.alltime-=1;
yyy.starttime+=30;
depositdata[msg.sender][testt[msg.sender][msgsender]]=Depositordata(yyy.oncemorney,yyy.alltime,yyy.starttime);
pple[msgsender][testt[msg.sender][msgsender]]=apple(msg.sender,yy.money1);
}
function setTime(uint onece,uint8 _year,uint8 _month)public {
Depositordata memory yyy;
require(save[msg.sender]==1);
yyy.oncemorney = onece;
yyy.starttime = now+(_year*86400*30*12)+(_month);
yyy.alltime = pple[msg.sender][test1[msg.sender]].money1/onece;
save[msg.sender]=0;
test1[msg.sender]++;
depositdata [test[msg.sender][test1[msg.sender]]][test1[msg.sender]]=Depositordata(yyy.oncemorney,yyy.alltime,yyy.starttime);
}
}