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

feat(distributor): add reentrancy guard #132

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

0xble
Copy link
Collaborator

@0xble 0xble commented Sep 22, 2022

@height
Copy link

height bot commented Sep 22, 2022

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@@ -379,13 +379,16 @@ contract TokenDistributor is ITokenDistributor {
{
bytes32 balanceId = _getBalanceId(tokenType, token);
// Reduce stored token balance.
_storedBalances[balanceId] -= amount;
uint256 storedBalance = _storedBalances[balanceId] - amount;
// Temporarily set to max as a reentrancy guard.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we explain how this works and what attack it's preventing?

distributor = _distributor;
}

function transfer(address to, uint256 amount) public virtual override returns (bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we comment that this sequence of operations mimics ERC777?

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