Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions snapshots/NativeTokenGateway.Operations.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"borrowNative": "229316",
"repayNative": "168024",
"supplyAsCollateralNative": "160373",
"supplyNative": "136476",
"withdrawNative: full": "125620",
"withdrawNative: partial": "136825"
"borrowNative": "229338",
"repayNative": "167980",
"supplyAsCollateralNative": "160372",
"supplyNative": "136458",
"withdrawNative: full": "125638",
"withdrawNative: partial": "136847"
}
16 changes: 8 additions & 8 deletions snapshots/SignatureGateway.Operations.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"borrowWithSig": "215605",
"repayWithSig": "188872",
"setSelfAsUserPositionManagerWithSig": "75402",
"setUsingAsCollateralWithSig": "85053",
"supplyWithSig": "153205",
"updateUserDynamicConfigWithSig": "62769",
"updateUserRiskPremiumWithSig": "61579",
"withdrawWithSig": "131696"
"borrowWithSig": "215627",
"repayWithSig": "188828",
"setSelfAsUserPositionManagerWithSig": "75424",
"setUsingAsCollateralWithSig": "85075",
"supplyWithSig": "153187",
"updateUserDynamicConfigWithSig": "62791",
"updateUserRiskPremiumWithSig": "61601",
"withdrawWithSig": "131713"
}
10 changes: 5 additions & 5 deletions snapshots/Spoke.Getters.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"getUserAccountData: supplies: 0, borrows: 0": "11937",
"getUserAccountData: supplies: 1, borrows: 0": "48600",
"getUserAccountData: supplies: 2, borrows: 0": "80378",
"getUserAccountData: supplies: 2, borrows: 1": "100166",
"getUserAccountData: supplies: 2, borrows: 2": "118596"
"getUserAccountData: supplies: 0, borrows: 0": "11959",
"getUserAccountData: supplies: 1, borrows: 0": "48622",
"getUserAccountData: supplies: 2, borrows: 0": "80400",
"getUserAccountData: supplies: 2, borrows: 1": "100188",
"getUserAccountData: supplies: 2, borrows: 2": "118618"
}
48 changes: 24 additions & 24 deletions snapshots/Spoke.Operations.ZeroRiskPremium.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"borrow: first": "191325",
"borrow: second action, same reserve": "171297",
"liquidationCall (receiveShares): full": "300103",
"liquidationCall (receiveShares): partial": "299821",
"liquidationCall: full": "310468",
"liquidationCall: partial": "310186",
"permitReserve + repay (multicall)": "166029",
"permitReserve + supply (multicall)": "146862",
"permitReserve + supply + enable collateral (multicall)": "160573",
"repay: full": "126094",
"repay: partial": "130983",
"setUserPositionManagerWithSig: disable": "44846",
"setUserPositionManagerWithSig: enable": "68875",
"supply + enable collateral (multicall)": "140624",
"supply: 0 borrows, collateral disabled": "123679",
"supply: 0 borrows, collateral enabled": "106601",
"supply: second action, same reserve": "106579",
"updateUserDynamicConfig: 1 collateral": "73694",
"updateUserDynamicConfig: 2 collaterals": "88551",
"updateUserRiskPremium: 1 borrow": "94804",
"updateUserRiskPremium: 2 borrows": "104619",
"usingAsCollateral: 0 borrows, enable": "58915",
"usingAsCollateral: 1 borrow, disable": "105072",
"usingAsCollateral: 1 borrow, enable": "41803",
"usingAsCollateral: 2 borrows, disable": "126055",
"usingAsCollateral: 2 borrows, enable": "41815",
"liquidationCall (receiveShares): full": "301099",
"liquidationCall (receiveShares): partial": "300817",
"liquidationCall: full": "311464",
"liquidationCall: partial": "311182",
"permitReserve + repay (multicall)": "166008",
"permitReserve + supply (multicall)": "146774",
"permitReserve + supply + enable collateral (multicall)": "160507",
"repay: full": "126116",
"repay: partial": "131005",
"setUserPositionManagerWithSig: disable": "44868",
"setUserPositionManagerWithSig: enable": "68897",
"supply + enable collateral (multicall)": "140536",
"supply: 0 borrows, collateral disabled": "123634",
"supply: 0 borrows, collateral enabled": "106556",
"supply: second action, same reserve": "106534",
"updateUserDynamicConfig: 1 collateral": "73716",
"updateUserDynamicConfig: 2 collaterals": "88573",
"updateUserRiskPremium: 1 borrow": "94826",
"updateUserRiskPremium: 2 borrows": "104641",
"usingAsCollateral: 0 borrows, enable": "58937",
"usingAsCollateral: 1 borrow, disable": "105094",
"usingAsCollateral: 1 borrow, enable": "41825",
"usingAsCollateral: 2 borrows, disable": "126077",
"usingAsCollateral: 2 borrows, enable": "41837",
"withdraw: 0 borrows, full": "128910",
"withdraw: 0 borrows, partial": "133473",
"withdraw: 1 borrow, partial": "161036",
Expand Down
48 changes: 24 additions & 24 deletions snapshots/Spoke.Operations.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"borrow: first": "261721",
"borrow: second action, same reserve": "204693",
"liquidationCall (receiveShares): full": "333666",
"liquidationCall (receiveShares): partial": "333384",
"liquidationCall: full": "344031",
"liquidationCall: partial": "343749",
"permitReserve + repay (multicall)": "163273",
"permitReserve + supply (multicall)": "146862",
"permitReserve + supply + enable collateral (multicall)": "160573",
"repay: full": "120256",
"repay: partial": "139545",
"setUserPositionManagerWithSig: disable": "44846",
"setUserPositionManagerWithSig: enable": "68875",
"supply + enable collateral (multicall)": "140624",
"supply: 0 borrows, collateral disabled": "123679",
"supply: 0 borrows, collateral enabled": "106601",
"supply: second action, same reserve": "106579",
"updateUserDynamicConfig: 1 collateral": "73694",
"updateUserDynamicConfig: 2 collaterals": "88551",
"updateUserRiskPremium: 1 borrow": "151080",
"updateUserRiskPremium: 2 borrows": "204276",
"usingAsCollateral: 0 borrows, enable": "58915",
"usingAsCollateral: 1 borrow, disable": "161348",
"usingAsCollateral: 1 borrow, enable": "41803",
"usingAsCollateral: 2 borrows, disable": "233712",
"usingAsCollateral: 2 borrows, enable": "41815",
"liquidationCall (receiveShares): full": "334662",
"liquidationCall (receiveShares): partial": "334380",
"liquidationCall: full": "345027",
"liquidationCall: partial": "344745",
"permitReserve + repay (multicall)": "163256",
"permitReserve + supply (multicall)": "146774",
"permitReserve + supply + enable collateral (multicall)": "160507",
"repay: full": "120278",
"repay: partial": "139567",
"setUserPositionManagerWithSig: disable": "44868",
"setUserPositionManagerWithSig: enable": "68897",
"supply + enable collateral (multicall)": "140536",
"supply: 0 borrows, collateral disabled": "123634",
"supply: 0 borrows, collateral enabled": "106556",
"supply: second action, same reserve": "106534",
"updateUserDynamicConfig: 1 collateral": "73716",
"updateUserDynamicConfig: 2 collaterals": "88573",
"updateUserRiskPremium: 1 borrow": "151102",
"updateUserRiskPremium: 2 borrows": "204298",
"usingAsCollateral: 0 borrows, enable": "58937",
"usingAsCollateral: 1 borrow, disable": "161370",
"usingAsCollateral: 1 borrow, enable": "41825",
"usingAsCollateral: 2 borrows, disable": "233734",
"usingAsCollateral: 2 borrows, enable": "41837",
"withdraw: 0 borrows, full": "128910",
"withdraw: 0 borrows, partial": "133473",
"withdraw: 1 borrow, partial": "214810",
Expand Down
5 changes: 4 additions & 1 deletion src/spoke/Spoke.sol
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ abstract contract Spoke is ISpoke, Multicall, NoncesKeyed, AccessManagedUpgradea
uint256 debtReserveId,
address user,
uint256 debtToCover,
uint256 minLiquidationBonus,
bool receiveShares
) external {
Reserve storage collateralReserve = _getReserve(collateralReserveId);
Expand Down Expand Up @@ -377,14 +378,16 @@ abstract contract Spoke is ISpoke, Multicall, NoncesKeyed, AccessManagedUpgradea
activeCollateralCount: userAccountData.activeCollateralCount,
borrowedCount: userAccountData.borrowedCount,
liquidator: msg.sender,
minLiquidationBonus: minLiquidationBonus,
receiveShares: receiveShares
});

PositionStatus storage positionStatus = _positionStatus[user];
bool isUserInDeficit = LiquidationLogic.liquidateUser(
collateralReserve,
debtReserve,
_userPositions,
_positionStatus,
positionStatus,
_liquidationConfig,
collateralDynConfig,
params
Expand Down
2 changes: 1 addition & 1 deletion src/spoke/TreasurySpoke.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ contract TreasurySpoke is ITreasurySpoke, Ownable2Step {
}

/// @inheritdoc ISpokeBase
function liquidationCall(uint256, uint256, address, uint256, bool) external pure {
function liquidationCall(uint256, uint256, address, uint256, uint256, bool) external pure {
revert UnsupportedAction();
}

Expand Down
3 changes: 3 additions & 0 deletions src/spoke/interfaces/ISpoke.sol
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ interface ISpoke is ISpokeBase, IMulticall, INoncesKeyed, IAccessManaged {
/// @notice Thrown when a debt to cover input is zero.
error InvalidDebtToCover();

/// @notice Thrown when the liquidation bonus is less than the minimum liquidation bonus.
error InvalidLiquidationBonus();

/// @notice Thrown when the liquidator tries to receive shares for a collateral reserve that is frozen or is not enabled to receive shares.
error CannotReceiveShares();

Expand Down
2 changes: 2 additions & 0 deletions src/spoke/interfaces/ISpokeBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ interface ISpokeBase {
/// @param debtReserveId The reserveId of the underlying asset borrowed by the liquidated user, to be repaid by Liquidator.
/// @param user The address of the user to liquidate.
/// @param debtToCover The desired amount of debt to cover.
/// @param minLiquidationBonus The minimum liquidation bonus applied to the liquidated user, in BPS. 100_00 represents 0.00% bonus.
/// @param receiveShares True to receive collateral in supplied shares, false to receive in underlying assets.
function liquidationCall(
uint256 collateralReserveId,
uint256 debtReserveId,
address user,
uint256 debtToCover,
uint256 minLiquidationBonus,
bool receiveShares
) external;

Expand Down
Loading
Loading