From 967f2a8bd16112b71b175eb686d21f8a9ed0602e Mon Sep 17 00:00:00 2001 From: Edwin Tops Date: Mon, 28 Aug 2023 23:21:25 +0200 Subject: [PATCH] Add distribute all handler. --- .../src/commands/feehandler/distribute-all.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/cli/src/commands/feehandler/distribute-all.ts diff --git a/packages/cli/src/commands/feehandler/distribute-all.ts b/packages/cli/src/commands/feehandler/distribute-all.ts new file mode 100644 index 00000000000..7ecfdc690b1 --- /dev/null +++ b/packages/cli/src/commands/feehandler/distribute-all.ts @@ -0,0 +1,23 @@ +import { BaseCommand } from '../../base' +import { displaySendTx } from '../../utils/cli' +import { Flags } from '../../utils/command' + +export default class DistributeAll extends BaseCommand { + static description = + 'Distributes the available tokens for all registered tokens to the beneficiaries.' + + static flags = { + ...BaseCommand.flags, + from: Flags.address({ required: true, description: "Initiator's address" }), + } + + static examples = ['distribute-all --from 0x5409ed021d9299bf6814279a6a1411a7e866a631'] + + async run() { + const res = this.parse(DistributeAll) + const from: string = res.flags.from + this.kit.defaultAccount = from + const feeHandler = await this.kit.contracts.getFeeHandler() + await displaySendTx('distributeAll', feeHandler.distributeAll(), {}, 'TokensDistributed') + } +}