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

🍶 Implement mocking receive function to revert #807

Merged
merged 9 commits into from
Jan 11, 2023
Merged

Conversation

rzadp
Copy link
Contributor

@rzadp rzadp commented Oct 21, 2022

Closes #739
Closes #557

@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2022

🦋 Changeset detected

Latest commit: e6b2cc4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@ethereum-waffle/mock-contract Patch
ethereum-waffle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

}

function forwardByCall() public payable {
(bool sent, bytes memory data) = payable(tokenContract).call{gas: 10000, value: msg.value}("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why gas is set to 10000?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not actually needed, removed.

let contract: Contract;

beforeEach(async () => {
[sender] = new MockProvider().getWallets();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doing mockERC20.provider each time feels unnatural

Suggested change
[sender] = new MockProvider().getWallets();
provider = new MockProvider()
[sender] = provider.getWallets();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yivlad yivlad merged commit fb6863d into master Jan 11, 2023
@yivlad yivlad deleted the rzadp/mock-receive branch January 11, 2023 11:28
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.

Mocking ether receive() Transferring ethers to a mocked contract
4 participants