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

Determine design for txn fees, if any #10

Open
fiddlemath opened this issue Sep 28, 2019 · 2 comments
Open

Determine design for txn fees, if any #10

fiddlemath opened this issue Sep 28, 2019 · 2 comments

Comments

@fiddlemath
Copy link
Contributor

If we have transfer fees in the future, what behavior do we actually want? Some sane options:

Option 1: transfer(recipient, value) deducts the fee from value:

  • balanceOf(msg.sender) -= value
  • balanceOf(recipient) += value - fee
  • balanceOf(feeTaker) += fee

Option 2: transfer(recipient, value) passes all of value to the recipient, and the sender pays a bit more:

  • balanceOf(msg.sender) -= value + fee
  • balanceOf(recipient) += value
  • balanceOf(feeTaker) += fee

Pros and cons:

  • In Option 1, you can cleanly transfer out the entire balance of an account. In Option 2, this would require computing just the right value such that value + fee equals the balance that you intend.
  • In Option 2, you can cleanly pay an exact amount to a recipient that requires that they wind up with a specific balance. In Option 1, this would, again, require the sender to compute just the right value based on the fee schedule.
  • Option 2 seems to more closely follow ERC-20, where the definition of transfer includes that it "Transfers _value tokens to address _to." Nowhere does it say that it transfers _value tokens away from the sender's address.

Option 3: In light of this, it seems to me that the ideal solution is to support both options as separate functions, where Option 2 gives the semantics of the transfer function, and Option 1 is implemented under some similar name (relocate? send?). Or, perhaps Option 4, where transfer is implemented only as in Option 2, and we implement transferAll(recipient) specifically for the case where someone wants to transfer all of their tokens.

@fiddlemath
Copy link
Contributor Author

Explication of PR discussion here: #9 (comment)

@tbrent
Copy link
Collaborator

tbrent commented Sep 28, 2019

I think we certainly want both options in some capacity, so it's between 3 and 4. I think I have a slight preference for #4. The main problem with #2 on its own has to do with what you do when you are sending your entire balance, and transferAll addresses that concern. Going with #3 feels like excessive generality and doesn't quite adhere to a single coherent philosophy, while #4 maintains the property that in all situations a specified value results in the recipient actually receiving that value.

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

2 participants