diff --git a/Circles.Index.CirclesV2/DatabaseSchema.cs b/Circles.Index.CirclesV2/DatabaseSchema.cs index 344fe39..994d68b 100644 --- a/Circles.Index.CirclesV2/DatabaseSchema.cs +++ b/Circles.Index.CirclesV2/DatabaseSchema.cs @@ -57,20 +57,6 @@ public class DatabaseSchema : IDatabaseSchema new("tokenAddress", ValueTypes.Address, true) ]); - // public static readonly EventSchema URI = - // EventSchema.FromSolidity("CrcV2", "event URI(string value, uint256 indexed id)"); - - public static readonly EventSchema URI = new EventSchema("CrcV2", "URI", - Keccak.Compute("URI(string,uint256)").BytesToArray(), [ - new("blockNumber", ValueTypes.Int, true), - new("timestamp", ValueTypes.Int, true), - new("transactionIndex", ValueTypes.Int, true), - new("logIndex", ValueTypes.Int, true), - new("value", ValueTypes.String, true), - new("id", ValueTypes.BigInt, true), - new("tokenAddress", ValueTypes.Address, true) - ]); - public static readonly EventSchema ApprovalForAll = EventSchema.FromSolidity( "CrcV2", "event ApprovalForAll(address indexed account, address indexed operator, bool approved)"); @@ -173,10 +159,6 @@ public class DatabaseSchema : IDatabaseSchema ("CrcV2", "TransferSingle"), TransferSingle }, - { - ("CrcV2", "URI"), - URI - }, { ("CrcV2", "ApprovalForAll"), ApprovalForAll diff --git a/Circles.Index.CirclesV2/LogParser.cs b/Circles.Index.CirclesV2/LogParser.cs index 949a756..0252f13 100644 --- a/Circles.Index.CirclesV2/LogParser.cs +++ b/Circles.Index.CirclesV2/LogParser.cs @@ -23,7 +23,6 @@ public class LogParser(Address v2HubAddress, Address erc20LiftAddress) : ILogPar private readonly Hash256 _transferBatchTopic = new(DatabaseSchema.TransferBatch.Topic); private readonly Hash256 _transferSingleTopic = new(DatabaseSchema.TransferSingle.Topic); private readonly Hash256 _approvalForAllTopic = new(DatabaseSchema.ApprovalForAll.Topic); - private readonly Hash256 _uriTopic = new(DatabaseSchema.URI.Topic); private readonly Hash256 _erc20WrapperDeployed = new(DatabaseSchema.ERC20WrapperDeployed.Topic); private readonly Hash256 _erc20WrapperTransfer = new(DatabaseSchema.Erc20WrapperTransfer.Topic); private readonly Hash256 _depositInflationary = new(DatabaseSchema.DepositInflationary.Topic); diff --git a/Circles.Index.Rpc/CirclesRpcModule.cs b/Circles.Index.Rpc/CirclesRpcModule.cs index 19b179d..97d70f1 100644 --- a/Circles.Index.Rpc/CirclesRpcModule.cs +++ b/Circles.Index.Rpc/CirclesRpcModule.cs @@ -339,12 +339,23 @@ public ResultWrapper circles_query(SelectDto query) return ResultWrapper.Success(result); } - public ResultWrapper circles_events(Address? address, long? fromBlock, long? toBlock = null, - string[]? eventTypes = null, FilterPredicateDto[]? filterPredicates = null, bool? sortAscending = false) + public ResultWrapper circles_events( + Address? address + , long? fromBlock + , long? toBlock = null + , string[]? eventTypes = null + , FilterPredicateDto[]? filterPredicates = null + , bool? sortAscending = false) { var queryEvents = new QueryEvents(_indexerContext); - return ResultWrapper.Success(queryEvents.CirclesEvents(address, fromBlock, toBlock, - eventTypes, filterPredicates, sortAscending)); + return ResultWrapper.Success( + queryEvents.CirclesEvents( + address + , fromBlock + , toBlock + , eventTypes + , filterPredicates + , sortAscending)); } public async Task> circlesV2_findPath(FlowRequest flowRequest) diff --git a/Circles.Index.Rpc/QueryEvents.cs b/Circles.Index.Rpc/QueryEvents.cs index 9a1a538..42680b6 100644 --- a/Circles.Index.Rpc/QueryEvents.cs +++ b/Circles.Index.Rpc/QueryEvents.cs @@ -26,8 +26,13 @@ public class QueryEvents(Context context) /// Additional filters to apply to the query. The filtered columns must be present in all queried events! /// An array of CirclesEvent objects /// Thrown when the zero address is queried, fromBlock is less than 0, toBlock is less than fromBlock, or toBlock is greater than the current head - public CirclesEvent[] CirclesEvents(Address? address, long? fromBlock, long? toBlock = null, - string[]? onlyTheseTypes = null, FilterPredicateDto[]? additionalFilters = null, bool? sortAscending = false) + public CirclesEvent[] CirclesEvents( + Address? address + , long? fromBlock + , long? toBlock = null + , string[]? onlyTheseTypes = null + , FilterPredicateDto[]? additionalFilters = null + , bool? sortAscending = false) { long currentHead = context.NethermindApi.BlockTree?.Head?.Number ?? throw new Exception("BlockTree or Head is null"); @@ -142,6 +147,13 @@ IFilterPredicate ToFilterPredicate(IFilterPredicateDto dto) queries.Add(query); } + + // Log all queries + Console.WriteLine($"Generated {queries.Count} event_queries:"); + foreach (var query in queries) + { + Console.WriteLine(query.ToSql(context.Database)); + } return queries; }