32 lines
927 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)
{
2025-07-31 11:05:11 +02:00
if (Program.GethLink == null)
{
await context.Followup("Blockchain operations are (temporarily) unavailable.");
return;
}
2023-10-20 10:14:56 +02:00
2025-07-31 11:05:11 +02:00
var gethNode = Program.GethLink.Node;
var contracts = Program.GethLink.Contracts;
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
}
}