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);
    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);
  • isNewLender is a modifier , and LenderRegistration is another contract that i imported with 4 parameters Commented Feb 8, 2019 at 2:36

1 Answer 1


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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