Solidity – Type Contract Not Convertible to Expected Type Address

addressessolidity

what is the wrong with this function
i can't get the address of LenderRegistration contract

mapping (address=>address) lendersToContracts;    
function lenderRegister(uint256 _rentedStorage) public isNewLender returns (bool) {
    lendersToContracts[msg.sender] = new LenderRegistration(Admin, _rentedStorage, Token, msg.sender);
    lenderIndex++;
    return true;
}

the error after compiling

typeError: Type contract LenderRegistration is not implicitly convertible to expected type address.
        lendersToContracts[msg.sender] = new  LenderRegistration(Admin, _rentedStorage , Token ,msg.sender);

Best Answer

See "explicit conversions": https://solidity.readthedocs.io/en/latest/types.html#address

lendersToContracts[msg.sender] = address(new LenderRegistration(...));
Related Topic