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

Should we revert on zero input #409

Closed
MathisGD opened this issue Aug 22, 2023 · 9 comments
Closed

Should we revert on zero input #409

MathisGD opened this issue Aug 22, 2023 · 9 comments
Assignees

Comments

@MathisGD
Copy link
Contributor

We revert when the input is zero, but we don't if the computed shares (resp. amount) is zero. Should we do it ? (it might be quite ugly)

See also #408

@MathisGD
Copy link
Contributor Author

Note that an other possibility (other than keeping the current code) would be to no longer revert on zero input.

NB: it gives a simple way to accrueInterest (after #405)

@MathisGD MathisGD self-assigned this Aug 22, 2023
@MathisGD
Copy link
Contributor Author

For exemple ERC20 are not supposed to revert on transfer zero

Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.

https://eips.ethereum.org/EIPS/eip-20#transfer

@MathisGD
Copy link
Contributor Author

After thinking about it, I don't think that we should revert. I don't see why we should revert on supplying a >0 amount that result in zero added shares / borrowing a >0 shares that result in a zero added amount.

But I have a new question: should we revert on zero inputs?

@MathisGD MathisGD changed the title Should we revert on computed amount/shares = 0 Should we revert on zero input Aug 22, 2023
@MathisGD
Copy link
Contributor Author

#410

@makcandrov
Copy link
Contributor

Indeed, we seem to be facing this issue again.

@MathisGD
Copy link
Contributor Author

Not exactly I'm only asking if we should revert on input (0,0)

@Rubilmax
Copy link
Collaborator

I have a preference for reverting, but most important to me is to be consistent with #398, #397 and other functions/events

@MathisGD
Copy link
Contributor Author

Agree

@MathisGD MathisGD closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2023
@makcandrov
Copy link
Contributor

Not exactly I'm only asking if we should revert on input (0,0)

It is kind of related. I still think #155 should be reopened.

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

No branches or pull requests

3 participants