Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update ownable with guardian #65

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/forge-std
4 changes: 2 additions & 2 deletions src/contracts/access-control/OwnableWithGuardian.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {IWithGuardian} from './interfaces/IWithGuardian.sol';
abstract contract OwnableWithGuardian is Ownable, IWithGuardian {
address private _guardian;

constructor(address initialOwner) Ownable(initialOwner) {
_updateGuardian(_msgSender());
constructor(address initialOwner, address initialGuardian) Ownable(initialOwner) {
_updateGuardian(initialGuardian);
}

modifier onlyGuardian() {
Expand Down
16 changes: 14 additions & 2 deletions src/contracts/access-control/UpgradeableOwnableWithGuardian.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ abstract contract UpgradeableOwnableWithGuardian is OwnableUpgradeable, IWithGua
}

/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
* @dev Initializes the contract setting the address provided by the deployer as the initial owner & guardian.
* @param initialOwner The address of the initial owner
* @param initialGuardian The address of the initial guardian
*/
function __Ownable_With_Guardian_init(address initialGuardian) internal onlyInitializing {
function __Ownable_With_Guardian_init(
address initialOwner,
address initialGuardian
) internal onlyInitializing {
__Ownable_init_unchained(initialOwner);
__Ownable_With_Guardian_init_unchained(initialGuardian);
}

function __Ownable_With_Guardian_init_unchained(
address initialGuardian
) internal onlyInitializing {
_updateGuardian(initialGuardian);
brotherlymite marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
Loading