rosetta-helium icon indicating copy to clipboard operation
rosetta-helium copied to clipboard

Discussion: Transfer operation vs Credit / Debit operations

Open syuan100 opened this issue 4 years ago • 0 comments

Primers:

Currently, token transfers are specified using two operations in this order:

  • A debit operation (- amount, account A)
  • A credit operation (+ amount, account B)

I decided to do this as a form of strongly "typing" the operations so that I can ensure a Debit occurs before a Credit, which also makes parsing Construction requests a little easier. However this forces the user to adhere to a stricter standard than other implementations.

Some implementations have a simple "transfer" operation, where the only difference is the signed "amount" for the operation. So for a token transfer, you would have two transfer operations like so:

  • A transfer operation (- amount, account A)
  • A transfer operation (+ amoun, account B)

This allows the end user to be more flexible when defining a token transfer, but error checking becomes a bit more tedious than having explicit debit and credit operations.

Would be happy to hear thoughts on what people think would be the best path forward.

syuan100 avatar Jun 01 '21 04:06 syuan100