1

Noob Question here. I have a Dapp that has no actual need of a web interface. What is the best way to activate functions if someone did something as simple as send Ether to an address it controls from a basic wallet?

Do i need to do something complex such as regularly ping it from Ethereum Alarm Clock or can a smart contract activate itself upon receiving a basic Ether transaction.

Plan is to just attach a human readable ENS name to the contract. People would send Ether to it like they would normally to any other address and it would automatically activate a function to re route it.

1 Answer 1

0

Yes, contracts can react to incoming Ether, and for incoming ERC-777 tokens as well.

For Ether activity, you need to set a fallback payable function.

However there are still other non-trivial ways to force Ether on the contract address without triggering the payable function, like another contract suicide. These cases should not concern normal users, but you need to take care of them in the accounting variables.

3
  • 1
    Exactly what I was looking for. Thanks a lot May 1, 2020 at 22:36
  • Don't forget to upvote and mark the answer as correct :) May 2, 2020 at 9:11
  • 1
    I will come back and upvote it when i have 15 rep thx May 3, 2020 at 4:53

Your Answer

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

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