Ethereum 以太坊事件未显示,但功能已完成
我有以下合同:Ethereum 以太坊事件未显示,但功能已完成,ethereum,smartcontracts,Ethereum,Smartcontracts,我有以下合同: Contract Store{ event Purchase(address buyer, int item_id); struct Product { string name; uint price; string desc; uint quantity; bool enabled; } mapping (address => int) balances;
Contract Store{
event Purchase(address buyer, int item_id);
struct Product {
string name;
uint price;
string desc;
uint quantity;
bool enabled;
}
mapping (address => int) balances;
function buyProduct(uint id) returns(bool){
if(products[id].quantity <= 0){ return false; }
balances[msg.sender] = balances[msg.sender] - int(products[id].price);
products[id].quantity--;
Purchase(msg.sender, id);
return true;
}
}
啊。它刚刚开始工作,我正在向事件传递一个
uint
,但它期望一个int
var eventFilter = Store.deployed().Purchase({from: "0xe02b4fc50f429624937e9425e1243292857291e2"}, {fromBlock: 0, toBlock: 'latest'});
eventFilter.watch(function(error, event){
console.log('hai');
console.log(event);
});