/ ProjectPlugins / GethPlugin / GethPlugin.cs
GethPlugin.cs
 1  using BlockchainUtils;
 2  using Core;
 3  
 4  namespace GethPlugin
 5  {
 6      public class GethPlugin : IProjectPlugin, IHasLogPrefix, IHasMetadata
 7      {
 8          private readonly GethStarter starter;
 9          private readonly IPluginTools tools;
10  
11          public GethPlugin(IPluginTools tools)
12          {
13              starter = new GethStarter(tools);
14              this.tools = tools;
15          }
16  
17          public string LogPrefix => "(Geth) ";
18  
19          public void Awake(IPluginAccess access)
20          {
21          }
22  
23          public void Announce()
24          {
25              tools.GetLog().Log($"Loaded Geth plugin.");
26          }
27  
28          public void AddMetadata(IAddMetadata metadata)
29          {
30              metadata.Add("gethid", GethContainerRecipe.DockerImage);
31          }
32  
33          public void Decommission()
34          {
35          }
36  
37          public GethDeployment DeployGeth(Action<IGethSetup> setup)
38          {
39              var startupConfig = new GethStartupConfig();
40              setup(startupConfig);
41              return starter.StartGeth(startupConfig);
42          }
43  
44          public IGethNode WrapGethDeployment(GethDeployment startResult, BlockCache blockCache)
45          {
46              startResult = SerializeGate.Gate(startResult);
47              return starter.WrapGethContainer(startResult, blockCache);
48          }
49      }
50  }