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

Extract reward token approve transaction to a separate function #1594

Merged
merged 2 commits into from
Jun 8, 2023

Conversation

Stefan-Ethernal
Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal commented Jun 7, 2023

Description

Extract approve reward pool transaction as a separate function, to make code cleaner.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@Stefan-Ethernal Stefan-Ethernal added the bug fix Functionality that fixes a bug label Jun 7, 2023
@Stefan-Ethernal Stefan-Ethernal requested a review from a team June 7, 2023 14:53
@Stefan-Ethernal Stefan-Ethernal self-assigned this Jun 7, 2023
@Nemanja0x
Copy link
Contributor

Some test have failed, probably we should check those before merge.

@Stefan-Ethernal Stefan-Ethernal changed the title Prevent approve transaction when native token is used for reward token Extract reward token approve transaction to separate function Jun 8, 2023
@Stefan-Ethernal
Copy link
Collaborator Author

Some test have failed, probably we should check those before merge.

You are right, I've made a mistake. We must send approve transaction to the reward token, independently which token is used for rewards (native or custom one). Since approve transaction allows reward pool to spend reward tokens on behalf of reward wallet. This is being done due to the fact that reward pool distributes rewards (see: https://github.com/0xPolygon/core-contracts/blob/dev/contracts/child/validator/RewardPool.sol#L77-L80).

Regarding this PR, functionality wise it is the same as before. However I find it necessary to extract reward token approval to a separate function.

@Stefan-Ethernal Stefan-Ethernal changed the title Extract reward token approve transaction to separate function Extract reward token approve transaction to a separate function Jun 8, 2023
@Stefan-Ethernal Stefan-Ethernal merged commit 52cae7e into develop Jun 8, 2023
7 checks passed
@Stefan-Ethernal Stefan-Ethernal deleted the EVM-684-dont-approve-native-reward-token branch June 8, 2023 07:22
@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Functionality that fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants