Jumpy Linen Swan
Medium
The changeOwner()
functions in AuctionFactory.sol
, DebitaV3Aggregator.sol
, and buyOrderFactory.sol
do not change the owner
state variable when called.
function changeOwner(address owner) public {
require(msg.sender == owner, "Only owner");
require(deployedTime + 6 hours > block.timestamp, "6 hours passed");
owner = owner;
}
This function checks msg.sender
against its argument instead of the owner
state variable. It will always revert if used as intended, within the intended constraints.
Instead of the deployer having a 6 hour window after deployment to call changeOwner()
on AuctionFactory.sol
, DebitaV3Aggregator.sol
, and buyOrderFactory.sol
, the function will not work at all.
If the circumstances of the deployment of these contracts necessitate a change of ownership, the contracts will have to be fixed and redeployed, and any fees spent on the original deployment will be lost.
Ensure that the address passed to the function is different from the contract's state variable, like so:
function changeOwner(address newOwner) public {
require(msg.sender == owner, "Only owner");
require(deployedTime + 6 hours > block.timestamp, "6 hours passed");
owner = newOwner;
}