fix: setFeeDestination in snippet uses stale AddressAlreadySet one-time-setter pattern (#886)
This commit is contained in:
parent
5adf70518f
commit
cd67e8c1fd
1 changed files with 10 additions and 2 deletions
|
|
@ -264,6 +264,7 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
|||
|
||||
address private immutable deployer;
|
||||
address public feeDestination;
|
||||
bool public feeDestinationLocked;
|
||||
|
||||
int24 public lastRecenterTick;
|
||||
uint256 public lastRecenterTime;
|
||||
|
|
@ -272,7 +273,6 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
|||
event Recentered(int24 indexed currentTick, bool indexed isUp);
|
||||
|
||||
error ZeroAddressInSetter();
|
||||
error AddressAlreadySet();
|
||||
|
||||
constructor(address _factory, address _WETH9, address _kraiken, address _optimizer) {
|
||||
deployer = msg.sender;
|
||||
|
|
@ -303,8 +303,16 @@ contract LiquidityManager is ThreePositionStrategy, PriceOracle {
|
|||
function setFeeDestination(address feeDestination_) external {
|
||||
require(msg.sender == deployer, "only deployer");
|
||||
if (address(0) == feeDestination_) revert ZeroAddressInSetter();
|
||||
if (feeDestination != address(0)) revert AddressAlreadySet();
|
||||
// Block if explicitly locked OR if the current destination has since become a contract
|
||||
// (guards CREATE2 bypass: address looked like an EOA when set, bytecode deployed later)
|
||||
require(
|
||||
!feeDestinationLocked && (feeDestination == address(0) || feeDestination.code.length == 0),
|
||||
"fee destination locked"
|
||||
);
|
||||
feeDestination = feeDestination_;
|
||||
if (feeDestination_.code.length > 0) {
|
||||
feeDestinationLocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function recenter() external returns (bool isUp) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue