0

I have two simple questions.

  1. Does all the smart contracts that creates ERC20 tokens have the same function names like balanceOf and transfer? Or developer select those names as they want?

  2. Lets say i want to be intermediary, i create smart contract, people send me ether and after sometime they claim X tokens from contract. To do that i have to create instance of X tokens contract. When i do that and do transfer function does the X contract see contracts address as a sender or does it see the ones address who interacted with my contract?

  3. Who has to pay gas if contracts communicate with each other?

  • Also, who has to pay gas if contracts communicate with each other? – Lukas Junokas Apr 3 '18 at 9:26
0

As far as first question is concerned, I believe after reading the documentation of Ethereum, in order to implement ERC20 token one has to specifically use those names. Usage of those names is logical because that alone makes it "universal" or compliant. Besides, it is a way to ensure one token can communicate with another

0

1)

Yes. It is part of the standard. The balanceOf is a public mapping whose getter is generated by the EVM transfer is a transaction function, as part of the standard, it needs to have this name

2

Lets say i want to be intermediary, i create smart contract, people send me ether and after sometime they claim X tokens from contract. To do that i have to create instance of X tokens contract. When i do that and do transfer function does the X contract see contracts address as a sender or does it see the ones address who interacted with my contract?

Why would you create x instance? Your smart contract is made to handle your tokens. Just use it.

3) Who pays for gasif contracts communicate with each other?

It always is the transaction sender.

  • concerning second question, maybe i was not clear enough. The token contract is not mine. To be very clear: I will have access to good presale ICO. Through smart contract i want to create a pool, people send ether to that contract. I will send that ether to ico ant they will send tokens to that contract. And i want to distribute tokens to addresses who sent ether to my contract. So i assumed i need to create an instance of token contract. – Lukas Junokas Apr 3 '18 at 11:48
0

Answer(1): If your smart contract deployed on ethereum then you should follow the ERC20 standard for any action regarding token. A developer can't choose a custom name for token transfer, issue, allocation..etc...They should follow ERC20 standard.

Answer(2): you can alter your contract in a way that, if the contract address receives any ether from outside, a fixed number of X tokens will be sent to them.

Answer(3): When it comes to the gas fee, it's the price for the miners for validating your transaction. No matter if what action actually occurs. If you are pushing a transaction then the gas fee will be deducted from you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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