cs-codex-dist-tests/Tools/BiblioTech/BaseGethCommand.cs

29 lines
872 B
C#
Raw Normal View History

2023-10-24 13:25:45 +00:00
using BiblioTech.Options;
using CodexContractsPlugin;
2023-10-20 08:14:56 +00:00
using GethPlugin;
2023-10-20 07:49:23 +00:00
namespace BiblioTech
{
public abstract class BaseGethCommand : BaseCommand
{
protected override async Task Invoke(CommandContext context)
{
2024-01-22 09:27:07 +00:00
var gethConnector = GethConnector.GethConnector.Initialize(Program.Log);
2023-10-20 08:14:56 +00:00
2024-01-22 09:27:07 +00: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 08:14:56 +00:00
2023-10-24 13:25:45 +00:00
await Execute(context, gethNode, contracts);
2023-10-20 07:49:23 +00:00
}
2023-10-24 13:25:45 +00:00
protected abstract Task Execute(CommandContext context, IGethNode gethNode, ICodexContracts contracts);
2023-10-20 07:49:23 +00:00
}
}