Skip to content
Snippets Groups Projects

add balance to accounts

Open poka requested to merge account-balance into main
Compare and Show latest version
1 file
+ 20
2
Compare changes
  • Side-by-side
  • Inline
+ 20
2
@@ -153,8 +153,26 @@ export class DataHandler {
await this.updateAccountBalance(ctx, slashed.address, -slashed.amount);
}
// We don't need to process endowed accounts and dust lost accounts
// because they are handled in common transfers and removed accounts
// Process endowed accounts
for (const endowed of newData.endowed) {
ctx.log.info(
`New endowed account: ${endowed.address} received initial balance of ${endowed.amount} tokens`
);
const account = await this.getOrCreateAccount(ctx, endowed.address);
account.balance = endowed.amount;
this.data.accounts.set(endowed.address, account);
}
// Process dust lost accounts
for (const dustLost of newData.dustLost) {
ctx.log.info(
`Dust lost: ${dustLost.address} lost ${dustLost.amount} tokens due to falling below existential deposit`
);
const account = await this.getAccountByAddressOrFail(ctx, dustLost.address);
account.balance = 0n;
account.isActive = false;
this.data.accounts.set(dustLost.address, account);
}
// Process comments
for (const commentEvt of newData.comments) {
Loading