Skip to content
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

Add Fee Manager for erc-to-native bridge in POSDAO chain #164

Merged

Conversation

patitonar
Copy link
Contributor

Closes #159

deploy/README.md Outdated
@@ -351,6 +351,8 @@ VALIDATORS=0x 0x 0x
HOME_REWARDABLE=false
# The flag defining whether to use RewardableValidators contract and set a fee manager contract on Foreign network
FOREIGN_REWARDABLE=false
# Flag to define if Home network is a POSDAO and rewards are distributed by blockReward contract
HOME_POSDAO=false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider to have the parameter like HOME_FEE_MANAGER_TYPE and the value of this parameter will specify which fee manager should be deployed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for suggestion. Added here a448e3d Please check if possible values makes sense to you

setTotalBurntCoins(totalBurntCoins().add(valueToTransfer));
address(0).transfer(valueToTransfer);
uint256 valueToBurn = valueToTransfer;
if(isPOSDAOFeeManager()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this method should be called only in case if the fee manager is configured. So, could you consider the following changes:

  • introduce the new method in the POSDAO fee manager: getAmountToBurn. This will allow to locate all logic related to fee handling in the fee manager.
  • change the fall back method in the bridge contract as following:
// . . .
// . . .
uint256 valueToTransfer = msg.value;
uint256 valueToBurn = valueToTransfer;
address feeManager = feeManagerContract();
if (feeManager != address(0)) {
    valueToBurn = getAmountToBurn(valueToTransfer)
    uint256 fee = calculateFee(valueToTransfer, false, feeManager, HOME_FEE);
    valueToTransfer = valueToTransfer.sub(fee);
}
setTotalBurntCoins(totalBurntCoins().add(valueToBurn));
address(0).transfer(valueToBurn);
emit UserRequestForSignature(msg.sender, valueToTransfer);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions. Please check e605559

@ghost ghost added the in progress label Apr 18, 2019
@ghost ghost removed the in progress label Apr 22, 2019
@ghost ghost added the in progress label Apr 23, 2019
@akolotov
Copy link
Collaborator

We need to address the merge conflicts

…rc-native-posdao-chain

# Conflicts:
#	deploy/.env.example
#	deploy/src/erc_to_native/home.js
#	deploy/src/loadEnv.js
@ghost ghost removed the in progress label Apr 23, 2019
@patitonar
Copy link
Contributor Author

Merge conflicts fixed

@akolotov akolotov merged commit c7c84cf into 119-Epic-rewards-for-bridge-validators Apr 23, 2019
@ghost ghost removed the review label Apr 23, 2019
@akolotov akolotov deleted the #159-fee-erc-native-posdao-chain branch May 21, 2019 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants