@@ -127,7 +127,7 @@ pub trait Trait: frame_system::Trait + pallet_timestamp::Trait {
127
127
/// Currency type for deposit and withdraw.
128
128
type Currency : Currency < Self :: AccountId > ;
129
129
/// The overarching event type.
130
- type Event : From < Event > + Into < <Self as frame_system:: Trait >:: Event > ;
130
+ type Event : From < Event < Self > > + Into < <Self as frame_system:: Trait >:: Event > ;
131
131
/// Precompiles associated with this EVM engine.
132
132
type Precompiles : Precompiles ;
133
133
@@ -147,11 +147,17 @@ decl_storage! {
147
147
148
148
decl_event ! {
149
149
/// EVM events
150
- pub enum Event {
150
+ pub enum Event <T > where
151
+ <T as frame_system:: Trait >:: AccountId ,
152
+ {
151
153
/// Ethereum events from contracts.
152
154
Log ( Log ) ,
153
155
/// A contract has been created at given address.
154
156
Created ( H160 ) ,
157
+ /// A deposit has been made at a given address.
158
+ BalanceDeposit ( AccountId , H160 , U256 ) ,
159
+ /// A withdrawal has been made from a given address.
160
+ BalanceWithdraw ( AccountId , H160 , U256 ) ,
155
161
}
156
162
}
157
163
@@ -202,6 +208,7 @@ decl_module! {
202
208
Accounts :: mutate( & address, |account| {
203
209
account. balance += bvalue;
204
210
} ) ;
211
+ Module :: <T >:: deposit_event( Event :: <T >:: BalanceDeposit ( sender, address, bvalue) ) ;
205
212
}
206
213
207
214
/// Withdraw balance from EVM into currency/balances module.
@@ -225,6 +232,7 @@ decl_module! {
225
232
Accounts :: insert( & address, account) ;
226
233
227
234
T :: Currency :: resolve_creating( & sender, imbalance) ;
235
+ Module :: <T >:: deposit_event( Event :: <T >:: BalanceWithdraw ( sender, address, bvalue) ) ;
228
236
}
229
237
230
238
/// Issue an EVM call operation. This is similar to a message call transaction in Ethereum.
@@ -289,7 +297,7 @@ decl_module! {
289
297
} ,
290
298
) ?;
291
299
292
- Module :: <T >:: deposit_event( Event :: Created ( create_address) ) ;
300
+ Module :: <T >:: deposit_event( Event :: < T > :: Created ( create_address) ) ;
293
301
Ok ( ( ) )
294
302
}
295
303
@@ -327,7 +335,7 @@ decl_module! {
327
335
} ,
328
336
) ?;
329
337
330
- Module :: <T >:: deposit_event( Event :: Created ( create_address) ) ;
338
+ Module :: <T >:: deposit_event( Event :: < T > :: Created ( create_address) ) ;
331
339
Ok ( ( ) )
332
340
}
333
341
}
0 commit comments