Skip to content

Commit dc31f9a

Browse files
DhairyaSethimiguelmtzinfavniculae
committed
rft: cleanup riskPremium calc, rename InBaseCurrency to Value (#863)
Co-authored-by: miguelmtzinf <[email protected]> Co-authored-by: miguelmtz <[email protected]> Co-authored-by: Alexandru-Vlad Niculae <[email protected]>
1 parent 4ca83cd commit dc31f9a

29 files changed

+380
-429
lines changed

snapshots/Spoke.Getters.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"getUserAccountData: supplies: 0, borrows: 0": "12143",
3-
"getUserAccountData: supplies: 1, borrows: 0": "47248",
4-
"getUserAccountData: supplies: 2, borrows: 0": "77481",
5-
"getUserAccountData: supplies: 2, borrows: 1": "98321",
6-
"getUserAccountData: supplies: 2, borrows: 2": "117672"
2+
"getUserAccountData: supplies: 0, borrows: 0": "12119",
3+
"getUserAccountData: supplies: 1, borrows: 0": "47237",
4+
"getUserAccountData: supplies: 2, borrows: 0": "77470",
5+
"getUserAccountData: supplies: 2, borrows: 1": "98167",
6+
"getUserAccountData: supplies: 2, borrows: 2": "117518"
77
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
"borrow: first": "225460",
3-
"borrow: second action, same reserve": "205981",
4-
"liquidationCall: full": "310700",
5-
"liquidationCall: partial": "329643",
6-
"permitReserve + repay (multicall)": "264945",
2+
"borrow: first": "225297",
3+
"borrow: second action, same reserve": "205818",
4+
"liquidationCall: full": "310374",
5+
"liquidationCall: partial": "329317",
6+
"permitReserve + repay (multicall)": "264782",
77
"permitReserve + supply (multicall)": "144166",
88
"permitReserve + supply + enable collateral (multicall)": "178127",
9-
"repay: full": "158035",
10-
"repay: partial": "209398",
9+
"repay: full": "158024",
10+
"repay: partial": "209235",
1111
"setUserPositionManagerWithSig: disable": "44882",
1212
"setUserPositionManagerWithSig: enable": "68905",
1313
"supply + enable collateral (multicall)": "156069",
1414
"supply: 0 borrows, collateral disabled": "119045",
1515
"supply: 0 borrows, collateral enabled": "122172",
1616
"supply: 1 borrow": "122164",
1717
"supply: second action, same reserve": "105072",
18-
"updateUserDynamicConfig: 1 collateral": "73802",
19-
"updateUserDynamicConfig: 2 collaterals": "88662",
20-
"updateUserRiskPremium: 1 borrow": "160872",
21-
"updateUserRiskPremium: 2 borrows": "231846",
18+
"updateUserDynamicConfig: 1 collateral": "73787",
19+
"updateUserDynamicConfig: 2 collaterals": "88647",
20+
"updateUserRiskPremium: 1 borrow": "160721",
21+
"updateUserRiskPremium: 2 borrows": "231695",
2222
"usingAsCollateral: 0 borrows, enable": "58976",
23-
"usingAsCollateral: 1 borrow, disable": "171131",
23+
"usingAsCollateral: 1 borrow, disable": "170968",
2424
"usingAsCollateral: 1 borrow, enable": "32298",
25-
"usingAsCollateral: 2 borrows, disable": "256477",
25+
"usingAsCollateral: 2 borrows, disable": "256314",
2626
"usingAsCollateral: 2 borrows, enable": "41876",
27-
"withdraw: 0 borrows, full": "129835",
28-
"withdraw: 0 borrows, partial": "136170",
29-
"withdraw: 1 borrow, partial": "226925",
30-
"withdraw: 2 borrows, partial": "312260",
27+
"withdraw: 0 borrows, full": "129820",
28+
"withdraw: 0 borrows, partial": "136159",
29+
"withdraw: 1 borrow, partial": "226762",
30+
"withdraw: 2 borrows, partial": "312097",
3131
"withdraw: non collateral": "126292"
3232
}

snapshots/Spoke.Operations.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
"borrow: first": "250960",
3-
"borrow: second action, same reserve": "214381",
4-
"liquidationCall: full": "319316",
5-
"liquidationCall: partial": "338259",
6-
"permitReserve + repay (multicall)": "273561",
2+
"borrow: first": "250797",
3+
"borrow: second action, same reserve": "214218",
4+
"liquidationCall: full": "318990",
5+
"liquidationCall: partial": "337933",
6+
"permitReserve + repay (multicall)": "273398",
77
"permitReserve + supply (multicall)": "144166",
88
"permitReserve + supply + enable collateral (multicall)": "178127",
9-
"repay: full": "152251",
10-
"repay: partial": "218014",
9+
"repay: full": "152240",
10+
"repay: partial": "217851",
1111
"setUserPositionManagerWithSig: disable": "44882",
1212
"setUserPositionManagerWithSig: enable": "68905",
1313
"supply + enable collateral (multicall)": "156069",
1414
"supply: 0 borrows, collateral disabled": "119045",
1515
"supply: 0 borrows, collateral enabled": "122172",
1616
"supply: 1 borrow": "122164",
1717
"supply: second action, same reserve": "105072",
18-
"updateUserDynamicConfig: 1 collateral": "73802",
19-
"updateUserDynamicConfig: 2 collaterals": "88662",
20-
"updateUserRiskPremium: 1 borrow": "177672",
21-
"updateUserRiskPremium: 2 borrows": "265446",
18+
"updateUserDynamicConfig: 1 collateral": "73787",
19+
"updateUserDynamicConfig: 2 collaterals": "88647",
20+
"updateUserRiskPremium: 1 borrow": "177521",
21+
"updateUserRiskPremium: 2 borrows": "265295",
2222
"usingAsCollateral: 0 borrows, enable": "58976",
23-
"usingAsCollateral: 1 borrow, disable": "187931",
23+
"usingAsCollateral: 1 borrow, disable": "187768",
2424
"usingAsCollateral: 1 borrow, enable": "32298",
25-
"usingAsCollateral: 2 borrows, disable": "290077",
25+
"usingAsCollateral: 2 borrows, disable": "289914",
2626
"usingAsCollateral: 2 borrows, enable": "41876",
27-
"withdraw: 0 borrows, full": "129835",
28-
"withdraw: 0 borrows, partial": "136170",
29-
"withdraw: 1 borrow, partial": "243725",
30-
"withdraw: 2 borrows, partial": "345860",
27+
"withdraw: 0 borrows, full": "129820",
28+
"withdraw: 0 borrows, partial": "136159",
29+
"withdraw: 1 borrow, partial": "243562",
30+
"withdraw: 2 borrows, partial": "345697",
3131
"withdraw: non collateral": "126292"
3232
}

src/hub/libraries/AssetLogic.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ library AssetLogic {
134134
uint256 assetId,
135135
IHub.SpokeData storage feeReceiver
136136
) internal {
137-
uint256 drawnIndex = asset.getDrawnIndex();
138-
uint256 indexDelta = drawnIndex.uncheckedSub(asset.drawnIndex);
137+
uint256 newDrawnIndex = asset.getDrawnIndex();
138+
uint256 indexDelta = newDrawnIndex.uncheckedSub(asset.drawnIndex);
139139

140-
asset.drawnIndex = drawnIndex.toUint128();
140+
asset.drawnIndex = newDrawnIndex.toUint128();
141141
asset.lastUpdateTimestamp = block.timestamp.toUint32();
142142

143143
uint128 feeShares = asset.getFeeShares(indexDelta).toUint128();

src/position-manager/SignatureGateway.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ contract SignatureGateway is
274274
address onBehalfOf,
275275
uint256 value,
276276
uint256 deadline,
277-
uint8 v,
278-
bytes32 r,
279-
bytes32 s
277+
uint8 permitV,
278+
bytes32 permitR,
279+
bytes32 permitS
280280
) external {
281281
(IERC20 underlying, ) = _getReserveData(reserveId);
282282
try
@@ -285,9 +285,9 @@ contract SignatureGateway is
285285
spender: address(this),
286286
value: value,
287287
deadline: deadline,
288-
v: v,
289-
r: r,
290-
s: s
288+
v: permitV,
289+
r: permitR,
290+
s: permitS
291291
})
292292
{} catch {}
293293
}

src/position-manager/interfaces/ISignatureGateway.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ interface ISignatureGateway is IMulticall, INoncesKeyed, IRescuable {
160160
address onBehalfOf,
161161
uint256 value,
162162
uint256 deadline,
163-
uint8 v,
164-
bytes32 r,
165-
bytes32 s
163+
uint8 permitV,
164+
bytes32 permitR,
165+
bytes32 permitS
166166
) external;
167167

168168
/// @notice Permissioned operation to renounce self as user position manager on connected SPOKE() for specified `user`.

0 commit comments

Comments
 (0)