Create smartcontract instance from external contract address

12 Views Asked by At

In my solidity code i would to create different instances of an external contract starting from its address. i do this:

contract Campaign {

    address public constant PEARK_CONTRACT = 0x5B3...dC4;

    address[] public deployedPearks;

    function createPeark(uint _price, uint _retailprice, string memory _title, string memory _description, string memory _items, string memory _imagepath, uint _maxqty, uint _remainqty, uint _delivery) public restricted {

        address newPeark = address(new PEARK_CONTRACT(msg.sender, address(this), _price, _retailprice, _title, _description, _items, _imagepath, _maxqty, _remainqty, _delivery));
        deployedPearks.push(newPeark);
    }
}

but on the "PEARK_CONTRACT" const inside function i get:

TypeError: Name has to refer to a user-defined type.

How can i create an instance of another my smartcontract without import it into my main smartcontract?

So many thanks in advance Manuel

0

There are 0 best solutions below