2
0
mirror of synced 2025-01-10 08:36:13 +00:00
cs-codex-dist-tests/Tools/BiblioTech/BaseGethCommand.cs

29 lines
872 B
C#
Raw Normal View History

2023-10-24 15:25:45 +02:00
using BiblioTech.Options;
using CodexContractsPlugin;
2023-10-20 10:14:56 +02:00
using GethPlugin;
2023-10-20 09:49:23 +02:00
namespace BiblioTech
{
public abstract class BaseGethCommand : BaseCommand
{
protected override async Task Invoke(CommandContext context)
{
2024-01-22 10:27:07 +01:00
var gethConnector = GethConnector.GethConnector.Initialize(Program.Log);
2023-10-20 10:14:56 +02:00
2024-01-22 10:27:07 +01:00
if (gethConnector == null) return;
var gethNode = gethConnector.GethNode;
var contracts = gethConnector.CodexContracts;
if (!contracts.IsDeployed())
{
await context.Followup("I'm sorry, the Codex SmartContracts are not currently deployed.");
return;
}
2023-10-20 10:14:56 +02:00
2023-10-24 15:25:45 +02:00
await Execute(context, gethNode, contracts);
2023-10-20 09:49:23 +02:00
}
2023-10-24 15:25:45 +02:00
protected abstract Task Execute(CommandContext context, IGethNode gethNode, ICodexContracts contracts);
2023-10-20 09:49:23 +02:00
}
}