Ownable above already has the owner and the modifier, and Vault repeats both. Two copies of a security check is one more than you can keep in step.
Inherit instead:
contract Vault is Ownable {Then delete the duplicated owner, the constructor and the modifier from Vault.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract Ownable {
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "not the owner");
_;
}
}
contract Vault {
uint256 public rate;
address public owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "not the owner");
_;
}
function setRate(uint256 newRate) external onlyOwner {
rate = newRate;
}
}