1

Is it possible to get the method of a contract deployed via instance. This is what I did and I am getting an error when I try calling the method from the RegistryLogic contract.

Registry registry = bioreg.SaveLandDetail(_OwnerAddr,_regAddr,_ReferenceCode,_Longitude) 
different number of components on the left hand side than on the right hand side

RegistryLogic.sol

import "./ExternalStorage.sol";
import "./Registry.sol";

contract RegistryLogic is ExternalStorage{

    mapping (bytes32 => Registry) private _Registry;
    mapping (bytes32 => Details) private _Detail;
    mapping(address => properties) property;
    struct properties{
        Registry[] assets;
        }

function bioDataReg(
        address _OwnerAddr,
        string memory _FamilyName,
        string memory _FamilyRep
    ) 
    returns(address, Registry)
    {
        Registry _bioRegistry = new Registry(
            _OwnerAddr,
            _FamilyName,
            _FamilyRep);
        property[_OwnerAddr].assets.push(_bioRegistry);
            return (_OwnerAddr, _bioRegistry);
    }


function Registration(
        address _OwnerAddr,
        address _regAddr,
        Registry _bioRegistry,
        bytes32 _ReferenceCode,
        bytes32 _Longitude,
        bytes32 _Latitude) public
        returns(bool) {
        Registry bioreg = property[_OwnerAddr].assets[0];
        Registry registry = bioreg.SaveLandDetail(_OwnerAddr,_regAddr,_ReferenceCode,_Longitude, _Latitude)

ExternalStorage.sol


contract ExternalStorage{

    //Variables
    address[] public Registry;
    mapping(address => profiles) profile;
    bioData public biodataDetails;
    landDetails public land;


    //profile of a client
    struct profiles{
        uint[] assetList;
        }


    //BioData Details
    struct bioData{
        address OwnerAddr;
        string FamilyName;
        string FamilyRep
    }

    //Land Details
    struct landDetails{
        address OwnerAddr;
        address regAddr;
        bytes32 ReferenceCode;
        bytes32 Longitude;
        bytes32 Latitude
    }

 }

Registry.sol

pragma solidity ^0.5.0;

import "./ExternalStorage.sol";

/**
 * @dev Land Registry Contract module.
 *
 * This module is used to create instance of registry contract.
 */

contract LandRegistry is ExternalStorage {

    constructor(
        address _OwnerAddr,
        string memory _FamilyName,
        string memory _FamilyRep
    )public {
        biodataDetails.OwnerAddr = _OwnerAddr;
        biodataDetails.FamilyName = _FamilyName;
        biodataDetails.FamilyRep = _FamilyRep
    }


    function SaveLandDetail(
        address _OwnerAddr,
        address _regAddr,
        bytes32 _ReferenceCode,
        bytes32 _Longitude,
        bytes32 _Latitude
    ) external
    {
        land.OwnerAddr = _OwnerAddr;
        land.regAddr = _regAddr;
        land.ReferenceCode = _ReferenceCode;
        land.Longitude = _Longitude;
        land.Latitude = _Latitude
    }

    function FamilyDetails()
        external view returns(
            address,
            string memory,
            string memory,
            string memory,
            string memory
        )
    {
        return (
            biodataDetails.OwnerAddr,
            biodataDetails.FamilyName,
            biodataDetails.FamilyRep,
            biodataDetails.FamilyRep_HouseAddress,
            biodataDetails.FamilyRep_Mobile_No
        );
    }

    function RegistryDetails()
        external view returns(
            address,
            address,
            bytes32,
            bytes32,
            bytes32
            ) {
        return (
            land.OwnerAddr,
            land.regAddr,
            land.ReferenceCode,
            land.Longitude,
            land.Latitude,
            );
    }

}
| improve this question | | | | |
0

You do Registry registry = bioreg.SaveLandDetail(...).

But function SaveLandDetail does not return anything (let alone a Registry instance).

| improve this answer | | | | |

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.