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

VIP: Allow environment variables and constants as "default value" in public functions #1525

Closed
haydenadams opened this issue Jul 10, 2019 · 2 comments · Fixed by #1607
Labels

Comments

@haydenadams
Copy link

@haydenadams haydenadams commented Jul 10, 2019

There are a number of Uniswap functions that have a recipient field. It would be great to default this field to msg.sender like so:

@public
@payable
def ethToTokenSwap(minTokens: uint256, recipient: address = msg.sender):

Currently I have to do something along these lines:

@public
@payable
def ethToTokenSwap(minTokens: uint256, recipient: address = 0x000...000):
   if(recipient == ZERO_ADDRESS):
      recipient = msg.sender

which isn't the worst but it would be great to have msg.sender, msg.value, and constants available here.

@haydenadams haydenadams changed the title Allow use of msg.sender, msg.value, and constants as "default value" in public functions VIP: Allow use of msg.sender, msg.value, and constants as "default value" in public functions Jul 10, 2019
@haydenadams haydenadams changed the title VIP: Allow use of msg.sender, msg.value, and constants as "default value" in public functions VIP: Allow msg.sender, msg.value, and constants as "default value" in public functions Jul 10, 2019
@jakerockland

This comment has been minimized.

Copy link
Contributor

@jakerockland jakerockland commented Jul 10, 2019

I'm a fan of this idea 👍

@fubuloubu

This comment has been minimized.

Copy link
Member

@fubuloubu fubuloubu commented Jul 10, 2019

So, allow constants and environment variables? I'm on board with that too

@haydenadams haydenadams changed the title VIP: Allow msg.sender, msg.value, and constants as "default value" in public functions VIP: Allow environment variables and constants as "default value" in public functions Jul 10, 2019
@jacqueswww jacqueswww added the Approved label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.