0

hopefully someone can help me with my question.

I have a factory to create an instance of a dealContract. Everything works except one thing. I cant send wei to the created instance, so lets see the code

 contract DealFactory {
    address[] public deployedDeals;


    function createDeal() public payable  {
        address newDeal = new Deal(msg.sender);

        deployedDeals.push(newDeal);

    }

    function getDeals() public view returns (address[]) {
        return deployedDeals;
    } 
}

The constructor of my Deal looks like this

 function Deal ( address _buyer) public payable {
      buyer

All i wanna do is, get the msg.value from the factory function to my Deal Contract.

Thanks in advance, I really have no idea how to do this

0

You could do:

address newDeal = new Deal(msg.sender);
newDeal.transfer(msg.value);

or you can also do:

address newDeal = (new Deal).value(msg.value)(msg.sender);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.