0

This is the Contract that I want to use a function of:

contract Origin{
    uint transfer_amount = 0.1 ether;
    address payable owner = xxx;
    function invest() external payable {
        owner.transfer(msg.value);
    }
    address payable[] recipients;
}

This is the Contract that I want to connect to the Origin-Contract:

contract Layer2{
    address addressOrigin;
    function setAddressOrigin(address _addressOrigin) external {
        addressOrigin = _addressOrigin;
    }
    function callinvest() external payable{
        Origin origin = Origin(addressOrigin);
        origin.invest();
        
    }
}

I have both Contracts in the same file. Both do compile, and I can deploy both to Ropsten. I cannot verify the code on ropsten.etherscan. It returns: DeclarationError: Identifier not found or not unique. The Error points to 'Origin' in Origin origin = Origin(addressOrigin)

Extra node: I struggle to understand what the line actually does. Also it confused me why the original function 'invest' doesn't need parameters in the code, but on ropsten.etherscan I can type in an amount of Eth to invest.

The goal is of course to use the invest function from the Layer2 Contract.

Your Answer

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

Browse other questions tagged or ask your own question.