Skip to content

Transferring A-EUR without ETH #84

@szerintedmi

Description

@szerintedmi

The issue
By default a user must have ETH to execute an A-EUR transfer to cover the transaction gas cost. We consider this as a high friction for the general A-EUR users. Users should be able to spend A-EURs they received (eg. from other users, services or from an exchange in return for fiat) without jumping through the hoops of buying ETH.

Solution proposal
EIP86 in Ethereum will allow contracts to pay the gas costs and it’s planned in the Constantinople Metropolis hard fork but its release date is uncertain.
As an interim solution we could allow trustless services to send in signed transfer transactions from users. This service will submit the transaction to the network, pay the transfer tx gas costs and it will be compensated by the token contract.
The client would be able to set any maximum compensation she is willing to pay in tokens. The service would request max that amount or less, depending on its strategy.

Questions

  1. Gas cost incurs in ETH and the gas price is set by the caller. Ideally we should compensate the Service in ETH as their gas costs are in ETH. But the user doesn't have ETH - that's the whole point of this change - so we could

    • a) compensate for gas costs in ETH from an Augmint account - this could be covered from a higher Augmint transfer fee for these type of transfers. But this way Augmint system would take fx risk (as fee in A-EUR and pay out in ETH).
    • b) cover gas costs from user's A-EUR balance - this way the caller Service takes fx risk but they can have multiple competing strategies offered to clients unlike if Augmint would set a rule.
      Proposing option b) but any better solution?
  2. The current thinking is to have specific delegated execution fx-s, e.g. delegatedTransfer

  • if that's the case then should be the TxDelegator contract separate and if so then should it be changebale? (see PR Delegated txs #89 for current first pass approach)
  1. Could this solution somehow used to incentify other services (e.g. merchants) to accept A-EUR? It would require to be able to reverse the fees, i.e. fees paid by beneficiary

Draft Flow

  1. Client signs the hash of the tx with her ETH account’s private key. Tx data: token address, from, to, nonce, minGasPrice, max executor fe in A-EUR)
  2. Client sends signed txhash + tx data to transaction submitter service
  3. Service validates tx signature and checks if user has enough funds to avoid rejected tx and lost gas cost
  4. Service forwards tx to A-EUR contract from its own ETH account, adding the submission reward it requests.
  5. A-EUR contract validates signature, nonce, gasPrice and submission reward
  6. A-EUR contract increments nonce and transfers A-EUR according to client instructions and sends reward to service
  7. Service sends confirmation to client

Implementation draft

new functions on AugmintToken contract:

function delegatedTransfer(
    AugmintTokenInterface augmintToken, address from, address to, uint amount, string narrative,
    uint maxExecutorFee, /* client provided max fee for executing the tx */
    bytes32 nonce, /* random nonce generated by client */
    /* ^^^^ end of signed data ^^^^ */
    bytes signature,
    uint requestedExecutorFee /* the executor can decide to request lower fee */
)

and

function delegatedTransferAndNotify(address from, TokenReceiver target, uint amount, uint data,
    uint maxExecutorFeeInToken, /* client provided max fee for executing the tx */
    bytes32 nonce, /* random nonce generated by client */
     /* ^^^^ end of signed data ^^^^ */
    bytes signature,
    uint requestedExecutorFeeInToken /* the executor can decide to request lower fee */
)

NB:

  • Nonce is random generated by client to allow concurrency and offline signing
  • Signature consist of sigV, sigR, sigS and destructured with inline assembly
  • We don't need chanId as it's in sigV and implicitly in augmintToken's address

Alternative generic implementation (scrapped)

A generic contract (TxDelegator ?) would receive any destination contract and transaction in a generic format, such having arbitrary tx calldata signed and passed as an argument to any contract.

E.g. Lock could be done with much less friction, without ETH. I.e. Buy A-EUR for fiat on an exchange, send lock tx immediately. After release the proceedings could be sent back to exchange without ETH again.

TxDelegator would verify the signature, manage the nonces and forward the call to any contract we wish :

destination.call.value(value)(calldata)

The receiving contract would allow the corresponding function(s) (e.g. delegatedTransfer in case of AugmintToken) to be called only by TxDelegator.

In addition TxDelegator could be able to compensate in any ERC20 tokens by adding an ERC20 token contract address as parameter to the call

Questions:

  • how could TxDelegator access the "from" in data passed against signer?
  • How executorFee would be deducted and what loopholes would it create?

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions