// User purchase msg
message BuyMsg {
number: Int as uint32;
}
message BuyEvent {
// Purchase address
buy: Address;
// Order number, unique, used to prevent duplicate purchases
orderNumber: Int as uint32;
}
// User places a bet
// add emit event
receive(msg: BuyMsg){
// Trigger event
let eventLog:BuyEvent=BuyEvent{
buy: ctx.sender,
orderNumber: msg.number
};
send(SendParameters{
to: self.owner,
value: 0,
mode: SendPayGasSeparately + SendIgnoreErrors,
bounce: false,
body: eventLog.toCell()
}
);
// Return Gas balance
let str:StringBuilder = beginComment().concat("good luck order:").concat(msg.orderNumber.toString());
self.reply(str.toCell());
}
标签:eventLog,orderNumber,number,BuyEvent,实例,ton,msg,event From: https://www.cnblogs.com/zhanchenjin/p/18407830