0

I would like to automatically after an event occurs to withdraw an amount of money from a certain ethereum address and keep the money with the contract. How can I do this? Any hint is appreciated.

I tried calling an internal payable function from my contract POD_PhysicalItems:

Here is how I call it, sender is an ethereum address defined in the constructor, but there is an error at the line below Type error Member "value" not found or not visible after argument dependent look up in the function address:

POD_PhysicalItems.withdrawAgreedUponCollateral.value(2*itemPrice)(sender);

This is the function:

 function withdrawAgreedUponCollateral(address entityAddress) payable internal  {
    require(state == contractState.DoneVerificationofTerms);
    collateralWithdrawnSuccessfully("Double deposit is withdrawn successfully from: ", entityAddress);

}
6
  • Can you provide more details on what you're trying to accomplish please? Do you mean send money from an ethereum address to the contract? What do you have so far/what have you tried?
    – Chris
    Commented Mar 17, 2018 at 14:56
  • So you have an address that is defined in the constructor of the contract. And when an event occurs, you want that address to send ether to entityAddress? Do i understand correctly?
    – Chris
    Commented Mar 17, 2018 at 15:18
  • @Chris I want the address which is the entityAddress or sender (same thing) to send ether to the contract itself
    – Haya Raed
    Commented Mar 17, 2018 at 15:19
  • @Chris entity address is the name of the argument taken bu the payable function and sender is the ethereum address that is passed when the function is called
    – Haya Raed
    Commented Mar 17, 2018 at 15:21
  • So you would just do that in web3. If entityAddress is the same address as the sender, you don't need the argument because you can just reference msg.sender. I answered a similar question here, lemme know if this helps: ethereum.stackexchange.com/questions/43022/…
    – Chris
    Commented Mar 17, 2018 at 15:24

1 Answer 1

2

Solved this over chat with the following example:

example

1
  • explained "you can't just withdraw directly from those accounts. this is because the only way for money to come from an account is for that account to explicitly sign a transaction send some value to the contract."
    – Haya Raed
    Commented Mar 17, 2018 at 16:15

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.