Skip to content

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

@haydenadams

Description

@haydenadams

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions