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
Closed
Labels
VIP: Approved VIP Approved

Comments

@haydenadams
Copy link

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
Copy link
Contributor

I'm a fan of this idea 👍

@fubuloubu
Copy link
Member

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 VIP: Approved VIP Approved label Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VIP: Approved VIP Approved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants