wip try get slot reserve calls

This commit is contained in:
ThatBen 2025-05-04 11:20:33 +02:00
parent 809b74b882
commit 1b38059559
No known key found for this signature in database
GPG Key ID: E020A7DDCD52E1AB
4 changed files with 38 additions and 1 deletions

View File

@ -143,5 +143,10 @@ namespace NethereumWorkflow
var blockTimeFinder = new BlockTimeFinder(blockCache, wrapper, log);
return blockTimeFinder.Get(number);
}
public BlockWithTransactions GetBlk(ulong number)
{
return Time.Wait(web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(new BlockParameter(number)));
}
}
}

View File

@ -4,6 +4,8 @@ using GethPlugin;
using Logging;
using Nethereum.Contracts;
using Nethereum.Hex.HexTypes;
using Nethereum.RPC.Eth.DTOs;
using Nethereum.Web3;
using Utils;
namespace CodexContractsPlugin
@ -19,6 +21,7 @@ namespace CodexContractsPlugin
SlotFreedEventDTO[] GetSlotFreedEvents();
SlotReservationsFullEventDTO[] GetSlotReservationsFullEvents();
ProofSubmittedEventDTO[] GetProofSubmittedEvents();
void Do();
}
public class CodexContractsEvents : ICodexContractsEvents
@ -33,10 +36,33 @@ namespace CodexContractsPlugin
this.gethNode = gethNode;
this.deployment = deployment;
BlockInterval = blockInterval;
Do();
}
public BlockInterval BlockInterval { get; }
public void Do()
{
for (ulong i = BlockInterval.From; i <= BlockInterval.To; i++)
{
var block = gethNode.GetBlk(i);
if (block == null) return;
foreach (var t in block.Transactions)
{
if (t == null) continue;
var input = t.ConvertToTransactionInput();
var aaa = t.DecodeTransactionToFunctionMessage<ReserveSlotFunction>();
if (aaa != null)
{
var a = 0;
}
}
}
}
public Request[] GetStorageRequests()
{
var events = gethNode.GetEvents<StorageRequestedEventDTO>(deployment.MarketplaceAddress, BlockInterval);

View File

@ -10,7 +10,7 @@ namespace CodexPlugin
public class ApiChecker
{
// <INSERT-OPENAPI-YAML-HASH>
private const string OpenApiYamlHash = "06-B9-41-E8-C8-6C-DE-01-86-83-F3-9A-E4-AC-E7-30-D9-E6-64-60-E0-21-81-9E-4E-C5-93-77-2C-71-79-14";
private const string OpenApiYamlHash = "FD-C8-0F-19-5E-14-09-C9-05-93-17-4A-97-50-1D-7E-37-50-B2-30-B2-E6-66-37-23-FA-35-F5-AB-A0-C6-BD";
private const string OpenApiFilePath = "/codex/openapi.yaml";
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";

View File

@ -31,6 +31,7 @@ namespace GethPlugin
List<EventLog<TEvent>> GetEvents<TEvent>(string address, TimeRange timeRange) where TEvent : IEventDTO, new();
BlockInterval ConvertTimeRangeToBlockRange(TimeRange timeRange);
BlockTimeEntry GetBlockForNumber(ulong number);
BlockWithTransactions GetBlk(ulong number);
}
public class DeploymentGethNode : BaseGethNode, IGethNode
@ -183,6 +184,11 @@ namespace GethPlugin
return StartInteraction().GetBlockForNumber(number);
}
public BlockWithTransactions GetBlk(ulong number)
{
return StartInteraction().GetBlk(number);
}
protected abstract NethereumInteraction StartInteraction();
}
}