团结继承

时间:2018-09-13 20:36:34

标签: typescript solidity web3

我有2份合同,一份用于注册,另一份合同与贷款有关。当我在混音上运行合同时,它也可以正常工作,并且还执行了贷款合同功能,但是当我在本地使用Truffle,AngularJs和testrpc运行相同的代码时,这两个功能都需要加价,但仅存储用户数据,不存储数据贷款

用户注册合同

pragma solidity ^0.4.18;
contract Loans{

    struct Loan {
    uint amount;
    string currency;
    string loanDescription;
    uint endDate;
    string returnPolicy;
}
mapping (address => Loan) loans;
address[] public allLoans;

function requestLoan(uint _amount,string _currency,string _description,uint _endDate,string _returnPolicy) public payable{
    Loan storage newLoan = loans[msg.sender];
    newLoan.amount = _amount;
    newLoan.currency = _currency;
    newLoan.loanDescription = _description;
    newLoan.endDate = _endDate;
    newLoan.returnPolicy = _returnPolicy;
    allLoans.push(msg.sender) -1;
}
}

}

贷款合同

async registerUser(){

const deployedUser = await this.User.deployed();
try{

const result = await deployedUser.setUser.sendTransaction(this.model.fname,this.model.lname,this.model.email,this.model.phone,"asd", {from: this.model.account}); 
  console.log(result);
 }
 catch(e)
 {
  console.log(e);
 }

 }

在AngularJs中,我使用这种方式来调用函数

{{1}}

0 个答案:

没有答案