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
|
|
|
|
|
{
|
2023-12-11 10:01:12 +00:00
|
|
|
|
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;
|
2023-12-18 12:32:58 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|