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

contract clean up for distribution #67

Merged
merged 1 commit into from
Dec 29, 2021
Merged

contract clean up for distribution #67

merged 1 commit into from
Dec 29, 2021

Conversation

ghostffcode
Copy link
Collaborator

No description provided.

total += values[i];
}

require(msg.value >= total, "Not enough Ether to distribute");
Copy link
Member

Choose a reason for hiding this comment

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

Could just be a hardhat node thing, but this requirement breaks the current tests in the latest tests on the dev branch

require(token.transfer(recipients[i], values[i]));

function distributeToken(
IERC20 token,
Copy link
Member

Choose a reason for hiding this comment

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

ERC20 implements the internal method _transfer(address sender, address recipient, uint256 amount) with requirements about spenders balances, null addresses, and allowances. Does that make these requirements redundant?

Copy link
Member

@hmrtn hmrtn left a comment

Choose a reason for hiding this comment

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

Minus the the tests that need to be written, this looks pretty solid! Check out the comments/questions about requirements.

Also worth noting, this contract is about 2X the gas to deploy.

Copy link
Member

@hmrtn hmrtn left a comment

Choose a reason for hiding this comment

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

It makes sense to not rely on the implementation of ERC20 contracts and instead have our own checks. In fact, we should look into using raricaptitals/solmates erc20 implementation

@hmrtn hmrtn merged commit b3adac4 into develop Dec 29, 2021
@hmrtn hmrtn deleted the contract-update branch December 29, 2021 18:24
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.

3 participants