Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Call ERC transfer with ETH from another account (i.e. meta-transactions) #1131

Closed
richwednesday opened this issue Oct 31, 2020 · 1 comment
Closed

Comments

@richwednesday
Copy link

I want to transfer an ERC20 token from accountA to accountB but only accountC has ETH (for gas fees).
Rather than transferring ETH from accountC to accountA first.

Can I call contract.transfer with accountA as the signer but send the transaction to the network with accountC?

@zemse
Copy link
Collaborator

zemse commented Oct 31, 2020

ATM, tx fee is debited from the balance of the one who signs a transaction.

but send the transaction to the network with accountC

Sending doesn't require a wallet, just a URL of node (RPC URL). Ethers js has a handy way to to that.

const provider = ethers.providers.JsonRpcProvider('rpc-url-of-the-node');
await provider.sendTransaction('0xSerializedTransaction');

Just wanted to make it clear that there is no role of accountC in the process of sending the transaction to the network.

Possible solutions

You can extend ERC20 contract, by adding a method called transferBySig that takes receiver, amount and signature. Recently there was interest about the same idea in ethereum/EIPs#3055. But this requires your contract to be deployed again.

I think I have read some proposals to get this done natively in ethereum so that no extra functionality is required in the contracts (each function would need a functionalityBySig counter part). But they definitely this feature isn't up right now. I don't remember the EIP number, so I don't know what is the community consensus on this idea.

@ricmoo ricmoo changed the title Call ERC Contract Transfer Method with ETH From Another Account Call ERC transfer with ETH from another account (i.e. meta-transactions) Feb 5, 2021
@ricmoo ricmoo closed this as completed Feb 5, 2021
@ethers-io ethers-io locked and limited conversation to collaborators Feb 5, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants