-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add fee handler for substrate #120
Conversation
1704808
to
f90106c
Compare
Hey @viatrix, my idea here was to also separate fee handler contracts for evm chains and generic message passing as separate implementations. Currently, we have this logic inside FeeHandlerWithOracle:
that determines if the processed message (deposit request) is just a basic token transfer or a generic message ( This approach allows users to do funky things like set this |
address tokenHandler = IBridge(_bridgeAddress)._resourceIDToHandlerAddress(resourceID); | ||
address tokenAddress = IERCHandler(tokenHandler)._resourceIDToTokenContractAddress(resourceID); | ||
|
||
txCost= oracleMessage.finalFee * oracleMessage.ter / 1e18; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
txCost= oracleMessage.finalFee * oracleMessage.ter / 1e18; | |
txCost = oracleMessage.finalFee * oracleMessage.ter / 1e18; |
depositData, | ||
feeData | ||
); | ||
assert.equal(Ethers.utils.formatUnits(res.fee.toString(), "wei"), "49180200000"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why formatting if it already has the same value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting needs a bit of a fix.
Co-authored-by: Oleksii Matiiasevych <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also should update names. I think next should works better:
FeeHandlerGeneric -> DynamicGenericFeeHandlerEVM
FeeHandlerSubstrate -> DynamicERC20FeeHandlerSubstrate
FeeHandlerWithOracle -> DynamicERC20FeeHandlerEVM
or something like that. I am open for proposals
Added a fee handler for Substrate.
Removed
feeData.amount
fromtxCost
calculations.Renamed fee handlers.
Description
Added a fee handler contract for Substrate based on
FeeHandlerWithOracle
(now renamed toDynamicFeeHandler
).Replaced
feeData.amount
withdepositData.amount
intxCost
calculations.feeData.amount
is not used at the moment but kept for possible uses in the future.Renamed fee handlers:
Created abstract contract
DynamicFeeHandler
Other fee handlers with oracle (dynamic fee handlers) inherit from
DynamicFeeHandler
:FeeHandlerGeneric
->DynamicGenericFeeHandlerEVM
FeeHandlerSubstrate
->DynamicERC20FeeHandlerSubstrate
FeeHandlerWithOracle
->DynamicERC20FeeHandlerEVM
Related Issue Or Context
Closes: #60, #122, #124
How Has This Been Tested? Testing details.
Added a unit test.
Types of changes
Checklist: