From 8ed7ff21b333b805610f3cd3f9da9667ad61f101 Mon Sep 17 00:00:00 2001 From: Kresh Date: Thu, 3 Oct 2024 13:06:22 +0400 Subject: [PATCH 1/3] style: add IStaticDelegateCallable --- src/contracts/common/StaticDelegateCallable.sol | 7 ++++++- src/interfaces/common/IStaticDelegateCallable.sol | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/interfaces/common/IStaticDelegateCallable.sol diff --git a/src/contracts/common/StaticDelegateCallable.sol b/src/contracts/common/StaticDelegateCallable.sol index 3e20125d..610661d5 100644 --- a/src/contracts/common/StaticDelegateCallable.sol +++ b/src/contracts/common/StaticDelegateCallable.sol @@ -1,7 +1,12 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.25; -abstract contract StaticDelegateCallable { +import {IStaticDelegateCallable} from "../../interfaces/common/IStaticDelegateCallable.sol"; + +abstract contract StaticDelegateCallable is IStaticDelegateCallable { + /** + * @inheritdoc IStaticDelegateCallable + */ function staticDelegateCall(address target, bytes calldata data) external { (bool success, bytes memory returndata) = target.delegatecall(data); bytes memory revertData = abi.encode(success, returndata); diff --git a/src/interfaces/common/IStaticDelegateCallable.sol b/src/interfaces/common/IStaticDelegateCallable.sol new file mode 100644 index 00000000..c0ae8317 --- /dev/null +++ b/src/interfaces/common/IStaticDelegateCallable.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IStaticDelegateCallable { + /** + * @notice Make a delegatecall from this contract to a given target contract with a particular data (always reverts with a return data). + * @param target address of the contract to make a delegatecall to + * @param data data to make a delegatecall with + * @dev It allows to use this contract's storage on-chain. + */ + function staticDelegateCall(address target, bytes calldata data) external; +} From f3bec1c442f5004c45b09ec8439171e3352b515d Mon Sep 17 00:00:00 2001 From: Kresh Date: Thu, 3 Oct 2024 13:07:27 +0400 Subject: [PATCH 2/3] fix: dev -> notice for burner() --- src/interfaces/vault/IVaultStorage.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interfaces/vault/IVaultStorage.sol b/src/interfaces/vault/IVaultStorage.sol index 188f0a56..7916cf74 100644 --- a/src/interfaces/vault/IVaultStorage.sol +++ b/src/interfaces/vault/IVaultStorage.sol @@ -48,7 +48,7 @@ interface IVaultStorage { function collateral() external view returns (address); /** - * @dev Get a burner to issue debt to (e.g., 0xdEaD or some unwrapper contract). + * @notice Get a burner to issue debt to (e.g., 0xdEaD or some unwrapper contract). * @return address of the burner */ function burner() external view returns (address); From af9628bbe6854a92b58b8ca0ab640346aeacf046 Mon Sep 17 00:00:00 2001 From: Kresh Date: Thu, 3 Oct 2024 13:22:26 +0400 Subject: [PATCH 3/3] fix: add account param to slashableBalanceOf() --- src/interfaces/vault/IVault.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interfaces/vault/IVault.sol b/src/interfaces/vault/IVault.sol index 9fbb73a1..5cc168de 100644 --- a/src/interfaces/vault/IVault.sol +++ b/src/interfaces/vault/IVault.sol @@ -215,7 +215,8 @@ interface IVault is IMigratableEntity, IVaultStorage { /** * @notice Get a total amount of the collateral that can be slashed for a given account. - * @return total amount of the slashable collateral + * @param account account to get the slashable collateral for + * @return total amount of the account's slashable collateral */ function slashableBalanceOf( address account