... 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
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:
- If the
msg.sender
is on the ACL, accept, process the payment and (contract should) log an event. - 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 encouragethrow
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.