Skip to content

Commit

Permalink
Removed unused URI event type
Browse files Browse the repository at this point in the history
  • Loading branch information
jaensen committed Nov 4, 2024
1 parent 965966b commit 25f7922
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
18 changes: 0 additions & 18 deletions Circles.Index.CirclesV2/DatabaseSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand Down Expand Up @@ -173,10 +159,6 @@ public class DatabaseSchema : IDatabaseSchema
("CrcV2", "TransferSingle"),
TransferSingle
},
{
("CrcV2", "URI"),
URI
},
{
("CrcV2", "ApprovalForAll"),
ApprovalForAll
Expand Down
1 change: 0 additions & 1 deletion Circles.Index.CirclesV2/LogParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
19 changes: 15 additions & 4 deletions Circles.Index.Rpc/CirclesRpcModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,23 @@ public ResultWrapper<DatabaseQueryResult> circles_query(SelectDto query)
return ResultWrapper<DatabaseQueryResult>.Success(result);
}

public ResultWrapper<CirclesEvent[]> circles_events(Address? address, long? fromBlock, long? toBlock = null,
string[]? eventTypes = null, FilterPredicateDto[]? filterPredicates = null, bool? sortAscending = false)
public ResultWrapper<CirclesEvent[]> 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<CirclesEvent[]>.Success(queryEvents.CirclesEvents(address, fromBlock, toBlock,
eventTypes, filterPredicates, sortAscending));
return ResultWrapper<CirclesEvent[]>.Success(
queryEvents.CirclesEvents(
address
, fromBlock
, toBlock
, eventTypes
, filterPredicates
, sortAscending));
}

public async Task<ResultWrapper<MaxFlowResponse>> circlesV2_findPath(FlowRequest flowRequest)
Expand Down
16 changes: 14 additions & 2 deletions Circles.Index.Rpc/QueryEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ public class QueryEvents(Context context)
/// <param name="additionalFilters">Additional filters to apply to the query. The filtered columns must be present in all queried events!</param>
/// <returns>An array of CirclesEvent objects</returns>
/// <exception cref="Exception">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</exception>
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");
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 25f7922

Please sign in to comment.