Ownable Contracts

function setKittyContractAddress(address _address) external {
kittyContract = KittyInterface(_address);
}

external 任何人都可以访问该函数修改该kittyContract 的地址,如何做到只有一个人访问该函数修改kittyContract 的值?
OpenZeppelin库的Ownable 合约
1.import “./ownable.sol”;
2.该合约contract ZombieFactory is Ownable
继承了Ownable合约

// 修改这个函数:
function setKittyContractAddress(address _address) external onlyOwner {
kittyContract = KittyInterface(_address);
}

你可能感兴趣的:(区块链)