1

... and if so what would this theoretical "rejected" transaction look like? Would the ETH/WEI be "auto-returned" back to the original Address?

1 Answer 1

2

Yes.

This question will probably be flagged as a duplicate so just a brief summary to help point you in the right direction.

"only Specified Address(es)": This would be an access control list (ACL) stored in the contract. See Are there well-solved and simple storage patterns for Solidity?. The contract would have admin functions to maintain the list.

"accept ETH/WEI": This would be a payable function. The function would check the ACL, then:

  1. If the msg.sender is on the ACL, accept, process the payment and (contract should) log an event.
  2. if the msg.sender is not on the ACL, reject. The precise form of rejection is somewhat a matter of use-case and style. I would encourage throw as your default solution.

In the case of throw, gas is destroyed, funds are returned and any changes to the contract state are reverted. No event is emitted. If you do not throw (e.g. return false;) then you will have to unwind those matters with your code.

In terms of appearance on the chain in the throw case, have a look here for some insight into what happens when a transaction runs out of gas. How to know if a transaction went through or not? (out of gas)

Hope it helps.

1
  • Nice one Rob, appreciated as always! : )
    – SHA256
    Jun 17, 2017 at 22:09

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.