@@ -220,6 +220,43 @@ parameter_type_with_key! {
220
220
} ;
221
221
}
222
222
223
+ thread_local ! {
224
+ pub static CREATED : RefCell <Vec <( AccountId , CurrencyId ) >> = RefCell :: new( vec![ ] ) ;
225
+ pub static KILLED : RefCell <Vec <( AccountId , CurrencyId ) >> = RefCell :: new( vec![ ] ) ;
226
+ }
227
+
228
+ pub struct TrackCreatedAccounts ;
229
+ impl TrackCreatedAccounts {
230
+ pub fn accounts ( ) -> Vec < ( AccountId , CurrencyId ) > {
231
+ CREATED . clone ( )
232
+ }
233
+
234
+ pub fn reset ( ) {
235
+ * CREATED = RefCell :: new ( vec ! [ ] ) ;
236
+ }
237
+ }
238
+ impl OnNewAccount < AccountId , CurrencyId > for TrackCreatedAccounts {
239
+ fn on_new_account ( who : & AccountId , currency : CurrencyId ) {
240
+ CREATED . push ( ( who, CurrencyId ) ) ;
241
+ }
242
+ }
243
+
244
+ pub struct TrackKilledAccounts ;
245
+ impl TrackKilledAccounts {
246
+ pub fn accounts ( ) -> Vec < ( AccountId , CurrencyId ) > {
247
+ KILLED . clone ( )
248
+ }
249
+
250
+ pub fn reset ( ) {
251
+ * KILLED = RefCell :: new ( vec ! [ ] ) ;
252
+ }
253
+ }
254
+ impl OnNewAccount < AccountId , CurrencyId > for TrackKilledAccounts {
255
+ fn on_new_account ( who : & AccountId , currency : CurrencyId ) {
256
+ KILLED . push ( ( who, CurrencyId ) ) ;
257
+ }
258
+ }
259
+
223
260
parameter_types ! {
224
261
pub DustReceiver : AccountId = PalletId ( * b"orml/dst" ) . into_account( ) ;
225
262
}
@@ -232,6 +269,8 @@ impl Config for Runtime {
232
269
type WeightInfo = ( ) ;
233
270
type ExistentialDeposits = ExistentialDeposits ;
234
271
type OnDust = TransferDust < Runtime , DustReceiver > ;
272
+ type OnNewAccount = TrackCreatedAccounts ;
273
+ type OnKilledAccount = TrackKilledAccounts ;
235
274
type MaxLocks = ConstU32 < 2 > ;
236
275
type MaxReserves = ConstU32 < 2 > ;
237
276
type ReserveIdentifier = ReserveIdentifier ;
@@ -296,6 +335,9 @@ impl ExtBuilder {
296
335
. unwrap ( ) ;
297
336
}
298
337
338
+ TrackCreatedAccounts :: reset ( ) ;
339
+ TrackKilledAccounts :: reset ( ) ;
340
+
299
341
let mut ext = sp_io:: TestExternalities :: new ( t) ;
300
342
ext. execute_with ( || System :: set_block_number ( 1 ) ) ;
301
343
ext
0 commit comments