-
Notifications
You must be signed in to change notification settings - Fork 25
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
Try unifying Proxy.mint() and Proxy.mintWithEth() into just Proxy.mint(). (Etc) #44
Conversation
(Tests pass btw) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is cool, I like it.
Do we want to add defaults (maybe ETH as default)?
function mint(minUsmOut) external payable returns (uint) {
return mint(msg.value, minUsmOut, EthType.ETH);
}
My only concern is that web3 might not work too well with overloading, I've had trouble with that before.
Quick take (may change): I'm not sure about defaults exactly, but I think |
I tried implementing the |
I spent a quite ridiculous amount of time debugging the
So the end result is these functions are unpleasantly redundant, which was the whole thing this PR was meant to avoid:
I guess our options are: I guess I lean towards c) unless we can get the overloading to work cleanly, but I'm open to your thoughts. |
Oh lord, that's not what I suggested, I'm sorry you went down this rabbit hole. My question was about a default type for the |
Oh sure don't worry, I knew it wasn't that important, I was just digging to try to understand this stuff. But how would you implement |
That is:
|
I suspect I could make both |
Ah, yeah, my proposal messes up with msg.sender. You would need an internal function that takes a |
Just FYI, making them both call an internal So this works:
|
Yeah, I'm not sure but I think that web3 has an issue with function overloading. Also we ended with as much code as we started, only more complex :P |
Yeah basically |
Just an idea I was toying with to avoid a bit of redundancy in the
Proxy
API. I guess could conceivably lead to confusion? But I dunno, seems worth it to me? I won't push by default but curious what you guys think.