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

feat: emergency liquidator draft #6

Closed
wants to merge 3 commits into from
Closed

Conversation

Van0k
Copy link
Collaborator

@Van0k Van0k commented May 30, 2024

No description provided.

/// @dev Returns whether the msg.sender can liquidate in lieu of policy
function _isPolicyWaived(address account) internal view returns (bool) {
return isWhitelisted[account]
&& block.timestamp > lastWhitelistedPolicyWaivedTimestamp + whitelistedPolicyWaiveDuration;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that these 2 vars could be combined into one allowedPublicLiquidationsTill, which could be set as block.timestamp + duration

/// whitelisted addresses
bool public whitelistedOnlyWithLoss;
/// @notice Map to substitute prices of tokens with other tokens, for policy checks
mapping(address => address) public priceAlias;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No method to get all set aliases in a call

@@ -46,13 +57,21 @@ contract EmergencyLiquidator is ACLNonReentrantTrait, IEmergencyLiquidatorExcept
/// @notice Whether the address is a trusted account capable of doing whitelist-only actions
mapping(address => bool) public isWhitelisted;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use EnumerableSet.Address to get all whitelisted liquidators

address creditManager,
address creditAccount,
MultiCall[] calldata calls
) external whitelistedOnly {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Porbably, it's good to make the contract pausable to block all liquidations if needed

@lekhovitsky lekhovitsky closed this Jan 2, 2025
@lekhovitsky lekhovitsky deleted the controller-timelock branch January 2, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants