Chain Interaction Service
Class: ChainInteractionService
Dependencies: * IMapper: An object mapper for mapping between objects. * DataContext: The data context for accessing the database. * IHttpContextAccessor: An accessor for accessing the HTTP context. * Web3: A library for interacting with Ethereum networks.
Constructor: * Initializes the class and sets the required dependencies. * Sets the connection timeout for the blockchain client. * Initializes the Web3 object with the Infura URL.
Private Methods:
- GetUserId()
Return Type: int
Description: Retrieves the user ID from the HTTP context.
- GetUserAddress()
Return Type: string
Description: Retrieves the user address from the HTTP context.
Methods:
- GetRegisterEventLogs():
Return Type: Task<ServiceResponse<List<EventLog<ProjectRegisterEventDTO>>>>
Description: Retrieves the event logs for project registration from the blockchain.
- GetWhiteListInsertEventLogs(string address):
- Parameters:
address: The address for filtering the event logs.
Return Type: Task<ServiceResponse<List<EventLog<WhitelistInsertEventDTO>>>>
Description: Retrieves the event logs for whitelist insertions from the blockchain.
- GetWhiteListRemoveEventLogs(string address):
- Parameters:
address: The address for filtering the event logs.
Return Type: Task<ServiceResponse<List<EventLog<WhitelistRemoveEventDTO>>>>
Description: Retrieves the event logs for whitelist removals from the blockchain.
- GetChainRole(string address):
- Parameters:
address: The address of the user.
Return Type: Task<ServiceResponse<string>>
Description: Retrieves the chain role of a user based on their address.
- GetAuctionFromHash(string projectHash):
- Parameters:
projectHash: The hash of the project.
Return Type: Task<ServiceResponse<string>>
Description: Retrieves the auction address associated with a project hash.
- IsAuctionCreatedInChain(string projectHash):
- Parameters:
projectHash: The hash of the project.
Return Type: Task<ServiceResponse<bool>>
Description: Checks if an auction is created in the blockchain for a given project hash.
- IsAuctionStartedInChain(string projectHash)
- Parameters:
projectHash: The hash of the project.
Return Type: Task<ServiceResponse<bool>>
Description: Checks if an auction is started in the blockchain for a given project hash.
- GetProjectEvaluationEventLogs():
Return Type: Task<ServiceResponse<List<EventLog<ProjectEvaluationEventDTO>>>>
Description: Retrieves the event logs for project evaluations from the blockchain.