0

If I deployed my contract on Ethereum. And there is some transactions between user and contract so if contract going to transfer some ether or tokens to user then contracts have to pay for fee. Is there is any way so that fee can deduct from contract creator(owner of contract)?

1 Answer 1

2

then contracts have to pay for fee

Not so. The contract doesn't pay fees. It's always the user.

User sends a transaction that deploys a contract and the user pays for it.

User sends a transaction to the contract and the user pays for the instructions that execute. It makes no difference if those instructions make the contract send funds. For example, the user pays the cost of processing a withdrawal.

Hope it helps.

6
  • I mean if there is erc721 token transfer to some user which have zero balance and that user wants to transfer that token to the contract owner so user have to pay the fee. But instead I want to make a contract like every time user transfer that token to the owner Owner will pay the fees.
    – kishan
    Commented Apr 5, 2021 at 4:34
  • The question isn't very clear. I suspect you are looking for the approve/transferFrom pattern where the sender authorizes the transfer (sender pays) and the receiver seizes the token (receiver pays). As far as the EVM is concerned, sender and receiver are both users paying for transaction processing at different stages of a coordinated process. Read up on ERC721 to understand what the functions do. Commented Apr 5, 2021 at 15:19
  • Suppose there is five client which has account i given to them. mean each person got one account mean total five account and each account has zero ether. someone transfer some ERC token to one of the account now if i want that token to transfer my account each account need fee so i need to transfer ether to each account. But instead i want to make contract like that each time they transfer tokens to my account it will deduct fee from my account. Sorry for my poor English!! and Thank you!!
    – kishan
    Commented Apr 6, 2021 at 3:48
  • You're not wrong. They would need money to send funds. You must not think about your contract spending their money because it cannot be done. Instead, think of everyone's money in the contract where the contract has control. Users commit funds to the contract, the contract does internal accounting, and users withdraw their money from the contract when they want to leave. They still pay for gas. Commented Apr 6, 2021 at 19:50
  • You should also not think about "account that I gave them" because this would imply that you know their signing keys, which you should not do. You make the contract disinterested in how they got their accounts. Assume they have a wallet. Your contract interacts with those addresses, whatever they are. Commented Apr 6, 2021 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.