contract MyContract {
struct Posposal{
    uint posposalId;//
    bytes1 description_;//
    uint userId;//
    uint amount;//
    address voteSponsorAddr;//

Posposal[] public curPosposals; //当前提议投票记录
uint public posposalNextId=0;// 标识投票建议递增  

function MyContract() {

uint public expId;
address public expTarget;
string public expDes;
function issuse(uint userId,address target_,uint amount_,string description_)  {

When I deploy this contract, and invoke function issue (pass params 1,0x7812b816a427974Ca61d56c7a7CfAaa011bb2351,1000,"transfer 100"), the transaction perform successfully. The variant expId,expTarget,expDes could get the right value, but curPosposals[0] is wrong? why? After several trials, when move bytes1 description_; to the last position, it works.

  • Your question is unclear: did the transaction succeed? Did you have enough gas? Did curProposals[0] have values? Were these values wrong? – Xavier Leprêtre B9lab Sep 6 '16 at 13:50
  • I have tested your code in browser solidity and curProposals[0] returns the desired values; how are you testing this? – 4gn3s Sep 6 '16 at 14:10
  • It could not return the desired values. when pass variants(1,0x7812b816a427974Ca61d56c7a7CfAaa011bb2351,1000,"transfer 100") ,expId=1,expTarget=0x7812b816a427974Ca61d56c7a7CfAaa011bb2351,expDes=transfer 100, but curProposals[0] returns error values. – Jim Green Sep 6 '16 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.