Update fee computation in coordinators #559
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR refactors
VRFCoordinator
andRequestResponseCoordinator
to a more unified structure throughCoordinatorBase
.sMinBalance
(use more precise computation)DirectPaymentConfig
with itsfulfillmentFee
andbaseFee
reqCount
for temporary accountpayment
) from fulfillment functions (cannot be accessed when executed through EOA anyway)computeCommitment
- differs between VRF & RR)numSubmission
to Request-Response'sRequestCommitment
(replacingsRequestToNumSubmission
)VRF
Regular Account
estimateTotalFee
function that returns a sum ofcalculateServiceFee
andmaxGasCost
(tx.gasprice * callbackGasLimit
). Fee tier discount can be applied based on reqCount.calculateServiceFee(reqCount)
(fee tier discount can be applied based onreqCount
) andcalculateGasCost
(tx.gasprice * (sConfig.gasAfterPaymentCalculation + actualGasUsed)
).Temporary Account
Request: Account balance is required to be above value returned from
estimateTotalFee
function that returns a sum ofcalculateServiceFee(reqCount)
andmaxGasCost
(tx.gasprice * callbackGasLimit
). Fee tier discount cannot be applied.Fulfillment: Account is charged the $KLAY amount that was deposited during request.
Request-Response
Regular Account
estimateTotalFee
function that returns a sum ofcalculateServiceFee(reqCount) * numSubmission
andmaxGasCost
(tx.gasprice * callbackGasLimit
). Consumer can request multiple submissions from oracles which leads to higher service fee that is proportional tonumSubmission
parameter specified by a consumer. Fee tier discount can be applied based onreqCount
.calculateServiceFee(reqCount)
(fee tier discount can be applied based onreqCount
) andcalculateGasCost
(tx.gasprice * (sConfig.gasAfterPaymentCalculation + actualGasUsed)
)Temporary Account
Request: Account balance is required to be above value returned from
estimateTotalFee
function that returns a sum ofcalculateServiceFee(reqCount) * numSubmission
andmaxGasCost
(tx.gasprice * callbackGasLimit
). Consumer can request multiple submissions from oracles which leads to higher service fee that is proportional tonumSubmission
parameter specified by a consumer. Fee tier discount cannot be applied.Fulfillment: Account is charged the $KLAY amount that was deposited during request.
Approximate Fee Distribution
Fees paid by Orakl Network consumers are distributed differently based on the account that was used to create a request. The approximate fee distribution is shown below.
Burn
represents a portion of a fee that will be burntOracle
represents a portion of a fee that will be given to an EOA off-chain oracle that fulfilled requestProtocol
represents a portion of a fee that will be given to Orakl Network for providing serviceRegular Account
Temporary Account
Type of change
Please delete options that are not relevant.
Checklist before requesting a review