I am new to developing smart contracts and have had some trouble trying to troubleshoot a solution to this problem.
I have two smart contracts...
Contract X: (The bank - Balance 100 ETH)
contract X {
function transfer(address dest){
dest.send(msg.value);
}
}
and...
Contract Y: (The Forwarder - Balance ZERO ETH)
contract Y {
function < somehow call x.transfer >
<set x.msg.value to some number ignoring the actual msg.value of the call>
}
Contract X will store some funds and contract Y will be used to call the 'transfer' function of contract X and provide a destination address to transfer funds to. The problem I am having is that I don't know how (or if it is possible) to set the value of 'msg.value' in contract X from the function call in contract Y.
Currently 'msg.value' in contract X is only ever zero since contract Y will not be used to store any funds (besides small amounts of wei for gas).
Does anybody know of a way to parse a specified 'msg.value' over a function call?
Side note: There are more to these contracts although it's not necessary to include them here.
Any help is greatly appreciated!
EDIT:
The desired result would look something like this:
contract Y > contract X:
msg.value
for this transaction will be zero (no funds sent from Y to X)- Y will supply
dest
address for contract X'stransfer
function - Y will supply
msg.value
for contract X'stransfer
function (This is my main isssue)
contract X > Destionation (dest) address:
transfer
function will use themsg.value
anddest
values provided by contract Y abovemsg.value
will never be zero
I guess the question is really if it is possible to parse a msg.value
to the external contract (contract X) to use as the msg.value
for X's transfer
- that is not the zero msg.value
from the the Y to X?