I have to access methods of one contract from another contract body. How can I realize that using just a address of first contract?

contract KittyShelter{
    address KittenRegistry;   //Here, KittenRegistry - is another contract

    constructor(address _KittenRegistry) public{
        KittenRegistry = _KittenRegistry;

    function storeKitty(uint256 catId, uint256 time) public{
    function retrieveKitty(uint256 catId) public{



Using address is a requirement

| improve this question | | | | |
  • Inside each one of these methods, verify that msg.sender is equal to that other contract's address. – goodvibration Oct 15 '19 at 12:55

In KittenRegistry contract first set address of KittyShelter contract. Then in the method, which you are calling from KittyShelter contract verify caller like: require(msg.sender == KittyShelter)

| 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.