2
0
mirror of synced 2025-01-10 00:25:49 +00:00
cs-codex-dist-tests/Tools/BiblioTech/BaseGethCommand.cs
2024-01-22 10:27:07 +01:00

29 lines
872 B
C#

using BiblioTech.Options;
using CodexContractsPlugin;
using GethPlugin;
namespace BiblioTech
{
public abstract class BaseGethCommand : BaseCommand
{
protected override async Task Invoke(CommandContext context)
{
var gethConnector = GethConnector.GethConnector.Initialize(Program.Log);
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;
}
await Execute(context, gethNode, contracts);
}
protected abstract Task Execute(CommandContext context, IGethNode gethNode, ICodexContracts contracts);
}
}