LubanCore.sol

Manages preconfirmation requests, settles transactions, and handles the escrow system for the Taiyi protocol

Functions

batchSettleRequests

function batchSettleRequests(PreconfRequest[] calldata preconfReqs) external payable

Settles multiple preconfirmation requests in a single transaction. This function processes a batch of preconfirmation requests, executing the associated transactions and handling the payment of tips. It’s designed to be called by the preconfirmer. Parameters:

NameTypeDescription
preconfReqsPreconfRequest[]An array of preconfirmation requests to be settled

settleRequest

function settleRequest(PreconfRequest calldata preconfReq) public payable nonReentrant

Settles a single PreconfRequest. This is the main function for validating and executing a preconfirmation request. The function will validate the request, execute the transaction, handle payments, and update the request status. Parameters:

NameTypeDescription
preconfReqPreconfRequestThe PreconfRequest struct to be settled

exhaust

function exhaust(PreconfRequest calldata preconfReq) external onlyOwner

Exhausts the gas to the point of gasLimit defined in TipTx iteratively, and transfers the prePayment to the preconfer. This function is used to prevent user “griefing” of the preconfer. It can only be called by the contract owner. Parameters:

NameTypeDescription
preconfReqPreconfRequestThe PreconfRequest struct to be exhausted

challengeRequests

function challengeRequests(PreconfRequest[] calldata preconfReqs) external

hallenges multiple PreconfRequests in a single call. This function allows users to challenge PreconfRequests that may not have been properly executed or included in a block. Parameters:

NameTypeDescription
preconfReqsPreconfRequest[]An array of PreconfRequest structs to be challenged

checkInclusion

function checkInclusion(bytes32 preconfRequestHash) external view returns (bool)

Checks if a PreconfRequest has been included in a block. Returns:

TypeDescription
boolTrue if the PreconfRequest has been included, false otherwise
Parameters:
NameTypeDescription
-------------------------
preconfRequestHashbytes32The hash of the PreconfRequest to check

getPreconfRequestStatus

function getPreconfRequestStatus(bytes32 preconferSignature) external view returns (PreconfRequestStatus)

Gets the status of a PreconfRequest. Returns:

TypeDescription
PreconfRequestStatusThe current status of the PreconfRequest
Parameters:
NameTypeDescription
-------------------------
preconferSignaturebytes32The signature of the PreconfRequest

collectTip

function collectTip(bytes32 preconferSignature) external

Collects the tip for a settled PreconfRequest. This function allows the preconfer to collect their tip after a PreconfRequest has been successfully settled. Parameters:

NameTypeDescription
preconferSignaturebytes32The signature of the PreconfRequest for which to collect the tip