title: Eth, how to call a deposit function from a smart contract
body: <p>I am working on a project where I need to send ether from an user to a smart contract and from the smart contract to the user. The smart contract is code in Solidity and I'm using python and web3.py to communicate with it.</p>
  
  <p>I manage to do it like this:
  From the user to the smart contract in my python script:</p>
  
  <pre><code>#send transaction to the smart contract
  web3.eth.sendTransaction({
      'to': address,
      'from': web3.eth.defaultAccount,
      'value': 10000000000000000000
  })
  </code></pre>
  
  <p>And from the smart contract to the user using this function:</p>
  
  <pre><code>function sendEther(address payable recipient, int _amount) public payable {
          recipient.transfer(_amout ether);
      }
  </code></pre>
  
  <p>Note that this function can be call in the smart contract.</p>
  
  <p>But then I wanted to create a function deposit (from user to smart contract) in my smart contract:</p>
  
  <pre><code>function deposit(uint256 amount) payable public {
          require(msg.value == amount);
          // nothing else to do!
      }
  </code></pre>
  
  <p>So basicaly, if I need to call this function with my python script, I need to proceed like this:</p>
  
  <pre><code>contract.functions.deposit(10).transac({
          'to': address,
          'from': web3.eth.defaultAccount,
          'value': 10
      })
  </code></pre>
  
  <p>And by checking the balance of the smart contract, it works correctly.</p>
  
  <p>But how do I need to proceed if I want to call the deposit function inside my smart contract and proceed to a transaction from user to smart contract? How do I parse the 'msg.value' in my smart contract when I call the function inside? Is that even possible?</p>
  
  <p>Many thanks,
  Alban</p>