【发布时间】:2020-07-30 15:13:12
【问题描述】:
如果标题有点混乱,我很抱歉。
我正在开发带有智能合约的以太坊区块链。
App={
createVoter1: function(){
App.contracts.Voting.deployed().then(function(instance) {
// use the contract function createBallot
var college = $("#college1").text();
var major = $("#major1").text();
var expirydate = $("#expirydate").text();
var serialnumber = $("#serialnumber1").text();
instance.createVoter(web3.eth.accounts[0],major,college,expirydate,serialnumber,"",[]);
})
},
ifVoterAddressExists: function(){
App.contracts.Voting.deployed().then(function(instance){
instance.ifVoterAddressExists(web3.eth.accounts[0]);
})
}
}
我在 createVoter1 函数之前跳过了一些代码。问题是,createVoter1 函数可以成功使用合约的函数。但是,当我使用 ifVoterAddressExists 时,会出现 Uncaught TypeError: Cannot read property 'deployed' of undefined 的警告。我可以知道是否有任何可能的解决方案?谢谢!
【问题讨论】:
标签: javascript ethereum solidity smartcontracts web3js