0

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{
        KittenRegistry;
    }
    function retrieveKitty(uint256 catId) public{

    }

}

Using address is a requirement

1
  • Inside each one of these methods, verify that msg.sender is equal to that other contract's address. Oct 15, 2019 at 12:55

1 Answer 1

0

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)

0

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.