-
Notifications
You must be signed in to change notification settings - Fork 228
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
Separate fee into home fee and foreign fee #151
Separate fee into home fee and foreign fee #151
Conversation
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.
We also told about the updates in the gas consumption document.
@akolotov Updated gas consumption document with latest changes |
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.
Few questions appeared. Please share you view.
@@ -157,7 +159,7 @@ contract HomeBridgeErcToNative is EternalStorage, BasicBridge, BasicHomeBridge, | |||
|
|||
address feeManager = feeManagerContract(); | |||
if (feeManager != address(0)) { | |||
uint256 fee = calculateFee(valueToMint, false, feeManager); | |||
uint256 fee = calculateFee(valueToMint, false, feeManager, FOREIGN_FEE); |
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 am a bit messed up. Let's clarify this together one more time:
Currently the examples of the .env
file says that;
# Fee to be charged for each transfer on Home network
# Makes sense only when HOME_REWARDABLE=true
# e.g. 0.1% fee
HOME_TRANSACTIONS_FEE=0.001
# Fee to be charged for each transfer on Foreign network
# Makes sense only when FOREIGN_REWARDABLE=true
# e.g. 0.1% fee
FOREIGN_TRANSACTIONS_FEE=0.001
What does Fee to be charged for each transfer on Foreign network
mean?
FOREIGN_FEE
means fee that we take for every transaction that directed form the Foreign network to the Home network
.
So, HOME_FEE
means fee that we take for every transaction that directed form the Home network to the Foreign network
Is it your understanding also? If so, does it make sense to re-phrase the statements in the examples?
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.
Thanks for clarification. Yes, that's my understanding too. I'll update documentation
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.
Fixed on b54cd53
|
||
function setFee(uint256 _fee) external onlyOwner { | ||
_setFee(feeManagerContract(), _fee); | ||
function setHomeFee(uint256 _fee) external onlyOwner { |
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.
Does it make sense to move these methods to the corresponding implementations of the bridges:
erc20_to_native/RewardableHomeBridgeErcToNative.sol
:setHomeFee
setForeignFee
getHomeFee
getForeignFee
native_to_erc20/RewardableHomeBridgeNativeToErc.sol
setForeignFee
getForeignFee
native_to_erc20/RewardableForeignBridgeNativeToErc.sol
setHomeFee
getHomeFee
By doing this we would:
- slightly reduce the code deployed.
- get rid of mess up especially in rhe case of
native-to-erc
mode.
What do you think?
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 agree on the changes, this would help on making code easier to follow
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.
Done 78d6c3b
@akolotov Comments were addressed. Also fixed |
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.
Thanks for improving this!
Added the following methods:
I had to update
calculateFee
to receive a parameter to know which fee it should use.Regarding this comment, I removed
setFee
andgetFee
since I couldn't find a use case for them unless I'm missing something. On bridge-ui usinggetFeeManagerMode
I think it will be enough to know which fee to use.Closes #149