Skip to content

Commit 40da504

Browse files
committed
chore: move mocks to different file
1 parent 96d7b44 commit 40da504

File tree

5 files changed

+173
-163
lines changed

5 files changed

+173
-163
lines changed

tests/extensions/v3-config-engine/AaveV3ConfigEngineTest.t.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ pragma solidity ^0.8.0;
44
import 'forge-std/Test.sol';
55
import {VmSafe} from 'forge-std/Base.sol';
66
import {IAaveV3ConfigEngine} from '../../../src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
7-
import {AaveV3MockListing, AaveV3MockListingWithEModeCreation} from './mocks/AaveV3MockListing.sol';
8-
import {AaveV3MockListingCustom, AaveV3MockListingCustomWithEModeCreation} from './mocks/AaveV3MockListingCustom.sol';
7+
import {AaveV3MockListing} from './mocks/AaveV3MockListing.sol';
8+
import {AaveV3MockListingWithEModeCreation} from './mocks/AaveV3MockListingWithEModeCreation.sol';
9+
import {AaveV3MockListingCustom} from './mocks/AaveV3MockListingCustom.sol';
10+
import {AaveV3MockListingCustomWithEModeCreation} from './mocks/AaveV3MockListingCustomWithEModeCreation.sol';
911
import {AaveV3MockCapUpdate} from './mocks/AaveV3MockCapUpdate.sol';
1012
import {AaveV3MockCollateralUpdate} from './mocks/AaveV3MockCollateralUpdate.sol';
1113
import {AaveV3MockCollateralUpdateNoChange} from './mocks/AaveV3MockCollateralUpdateNoChange.sol';

tests/extensions/v3-config-engine/mocks/AaveV3MockListing.sol

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -56,76 +56,3 @@ contract AaveV3MockListing is AaveV3Payload {
5656
return IEngine.PoolContext({networkName: 'Local', networkAbbreviation: 'Loc'});
5757
}
5858
}
59-
60-
contract AaveV3MockListingWithEModeCreation is AaveV3Payload {
61-
address public immutable ASSET_ADDRESS;
62-
address public immutable ASSET_FEED;
63-
64-
constructor(
65-
address assetAddress,
66-
address assetFeed,
67-
address customEngine
68-
) AaveV3Payload(IEngine(customEngine)) {
69-
ASSET_ADDRESS = assetAddress;
70-
ASSET_FEED = assetFeed;
71-
}
72-
73-
function newListings() public view override returns (IEngine.Listing[] memory) {
74-
IEngine.Listing[] memory listings = new IEngine.Listing[](1);
75-
76-
listings[0] = IEngine.Listing({
77-
asset: ASSET_ADDRESS,
78-
assetSymbol: '1INCH',
79-
priceFeed: ASSET_FEED,
80-
rateStrategyParams: IEngine.InterestRateInputData({
81-
optimalUsageRatio: 80_00,
82-
baseVariableBorrowRate: 25, // 0.25%
83-
variableRateSlope1: 3_00,
84-
variableRateSlope2: 75_00
85-
}),
86-
enabledToBorrow: EngineFlags.ENABLED,
87-
borrowableInIsolation: EngineFlags.DISABLED,
88-
withSiloedBorrowing: EngineFlags.DISABLED,
89-
flashloanable: EngineFlags.DISABLED,
90-
ltv: 82_50,
91-
liqThreshold: 86_00,
92-
liqBonus: 5_00,
93-
reserveFactor: 10_00,
94-
supplyCap: 85_000,
95-
borrowCap: 60_000,
96-
debtCeiling: 0,
97-
liqProtocolFee: 10_00
98-
});
99-
100-
return listings;
101-
}
102-
103-
function eModeCategoryCreations()
104-
public
105-
view
106-
override
107-
returns (IEngine.EModeCategoryCreation[] memory)
108-
{
109-
IEngine.EModeCategoryCreation[] memory eModeUpdates = new IEngine.EModeCategoryCreation[](1);
110-
111-
address[] memory collaterals = new address[](1);
112-
address[] memory borrowables = new address[](1);
113-
collaterals[0] = ASSET_ADDRESS;
114-
borrowables[0] = ASSET_ADDRESS;
115-
116-
eModeUpdates[0] = IEngine.EModeCategoryCreation({
117-
ltv: 97_40,
118-
liqThreshold: 97_60,
119-
liqBonus: 1_50,
120-
label: 'Listed Asset EMode',
121-
borrowables: borrowables,
122-
collaterals: collaterals
123-
});
124-
125-
return eModeUpdates;
126-
}
127-
128-
function getPoolContext() public pure override returns (IEngine.PoolContext memory) {
129-
return IEngine.PoolContext({networkName: 'Local', networkAbbreviation: 'Loc'});
130-
}
131-
}

tests/extensions/v3-config-engine/mocks/AaveV3MockListingCustom.sol

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -70,91 +70,3 @@ contract AaveV3MockListingCustom is AaveV3Payload {
7070
return IEngine.PoolContext({networkName: 'Local', networkAbbreviation: 'Loc'});
7171
}
7272
}
73-
74-
contract AaveV3MockListingCustomWithEModeCreation is AaveV3Payload {
75-
address public immutable ASSET_ADDRESS;
76-
address public immutable ASSET_FEED;
77-
78-
address public immutable A_TOKEN_IMPL;
79-
address public immutable V_TOKEN_IMPL;
80-
81-
constructor(
82-
address assetAddress,
83-
address assetFeed,
84-
address customEngine,
85-
address aTokenImpl,
86-
address vTokenImpl
87-
) AaveV3Payload(IEngine(customEngine)) {
88-
ASSET_ADDRESS = assetAddress;
89-
ASSET_FEED = assetFeed;
90-
A_TOKEN_IMPL = aTokenImpl;
91-
V_TOKEN_IMPL = vTokenImpl;
92-
}
93-
94-
function newListingsCustom()
95-
public
96-
view
97-
override
98-
returns (IEngine.ListingWithCustomImpl[] memory)
99-
{
100-
IEngine.ListingWithCustomImpl[] memory listingsCustom = new IEngine.ListingWithCustomImpl[](1);
101-
102-
listingsCustom[0] = IEngine.ListingWithCustomImpl(
103-
IEngine.Listing({
104-
asset: ASSET_ADDRESS,
105-
assetSymbol: 'PSP',
106-
priceFeed: ASSET_FEED,
107-
rateStrategyParams: IEngine.InterestRateInputData({
108-
optimalUsageRatio: 80_00,
109-
baseVariableBorrowRate: 25, // 0.25%
110-
variableRateSlope1: 3_00,
111-
variableRateSlope2: 75_00
112-
}),
113-
enabledToBorrow: EngineFlags.ENABLED,
114-
borrowableInIsolation: EngineFlags.DISABLED,
115-
withSiloedBorrowing: EngineFlags.DISABLED,
116-
flashloanable: EngineFlags.DISABLED,
117-
ltv: 82_50,
118-
liqThreshold: 86_00,
119-
liqBonus: 5_00,
120-
reserveFactor: 10_00,
121-
supplyCap: 85_000,
122-
borrowCap: 60_000,
123-
debtCeiling: 0,
124-
liqProtocolFee: 10_00
125-
}),
126-
IEngine.TokenImplementations({aToken: A_TOKEN_IMPL, vToken: V_TOKEN_IMPL})
127-
);
128-
129-
return listingsCustom;
130-
}
131-
132-
function eModeCategoryCreations()
133-
public
134-
view
135-
override
136-
returns (IEngine.EModeCategoryCreation[] memory)
137-
{
138-
IEngine.EModeCategoryCreation[] memory eModeUpdates = new IEngine.EModeCategoryCreation[](1);
139-
140-
address[] memory collaterals = new address[](1);
141-
address[] memory borrowables = new address[](1);
142-
collaterals[0] = ASSET_ADDRESS;
143-
borrowables[0] = ASSET_ADDRESS;
144-
145-
eModeUpdates[0] = IEngine.EModeCategoryCreation({
146-
ltv: 97_40,
147-
liqThreshold: 97_60,
148-
liqBonus: 1_50,
149-
label: 'Listed Asset EMode',
150-
borrowables: borrowables,
151-
collaterals: collaterals
152-
});
153-
154-
return eModeUpdates;
155-
}
156-
157-
function getPoolContext() public pure override returns (IEngine.PoolContext memory) {
158-
return IEngine.PoolContext({networkName: 'Local', networkAbbreviation: 'Loc'});
159-
}
160-
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
5+
6+
contract AaveV3MockListingCustomWithEModeCreation is AaveV3Payload {
7+
address public immutable ASSET_ADDRESS;
8+
address public immutable ASSET_FEED;
9+
10+
address public immutable A_TOKEN_IMPL;
11+
address public immutable V_TOKEN_IMPL;
12+
13+
constructor(
14+
address assetAddress,
15+
address assetFeed,
16+
address customEngine,
17+
address aTokenImpl,
18+
address vTokenImpl
19+
) AaveV3Payload(IEngine(customEngine)) {
20+
ASSET_ADDRESS = assetAddress;
21+
ASSET_FEED = assetFeed;
22+
A_TOKEN_IMPL = aTokenImpl;
23+
V_TOKEN_IMPL = vTokenImpl;
24+
}
25+
26+
function newListingsCustom()
27+
public
28+
view
29+
override
30+
returns (IEngine.ListingWithCustomImpl[] memory)
31+
{
32+
IEngine.ListingWithCustomImpl[] memory listingsCustom = new IEngine.ListingWithCustomImpl[](1);
33+
34+
listingsCustom[0] = IEngine.ListingWithCustomImpl(
35+
IEngine.Listing({
36+
asset: ASSET_ADDRESS,
37+
assetSymbol: 'PSP',
38+
priceFeed: ASSET_FEED,
39+
rateStrategyParams: IEngine.InterestRateInputData({
40+
optimalUsageRatio: 80_00,
41+
baseVariableBorrowRate: 25, // 0.25%
42+
variableRateSlope1: 3_00,
43+
variableRateSlope2: 75_00
44+
}),
45+
enabledToBorrow: EngineFlags.ENABLED,
46+
borrowableInIsolation: EngineFlags.DISABLED,
47+
withSiloedBorrowing: EngineFlags.DISABLED,
48+
flashloanable: EngineFlags.DISABLED,
49+
ltv: 82_50,
50+
liqThreshold: 86_00,
51+
liqBonus: 5_00,
52+
reserveFactor: 10_00,
53+
supplyCap: 85_000,
54+
borrowCap: 60_000,
55+
debtCeiling: 0,
56+
liqProtocolFee: 10_00
57+
}),
58+
IEngine.TokenImplementations({aToken: A_TOKEN_IMPL, vToken: V_TOKEN_IMPL})
59+
);
60+
61+
return listingsCustom;
62+
}
63+
64+
function eModeCategoryCreations()
65+
public
66+
view
67+
override
68+
returns (IEngine.EModeCategoryCreation[] memory)
69+
{
70+
IEngine.EModeCategoryCreation[] memory eModeUpdates = new IEngine.EModeCategoryCreation[](1);
71+
72+
address[] memory collaterals = new address[](1);
73+
address[] memory borrowables = new address[](1);
74+
collaterals[0] = ASSET_ADDRESS;
75+
borrowables[0] = ASSET_ADDRESS;
76+
77+
eModeUpdates[0] = IEngine.EModeCategoryCreation({
78+
ltv: 97_40,
79+
liqThreshold: 97_60,
80+
liqBonus: 1_50,
81+
label: 'Listed Asset EMode',
82+
borrowables: borrowables,
83+
collaterals: collaterals
84+
});
85+
86+
return eModeUpdates;
87+
}
88+
89+
function getPoolContext() public pure override returns (IEngine.PoolContext memory) {
90+
return IEngine.PoolContext({networkName: 'Local', networkAbbreviation: 'Loc'});
91+
}
92+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
5+
6+
contract AaveV3MockListingWithEModeCreation is AaveV3Payload {
7+
address public immutable ASSET_ADDRESS;
8+
address public immutable ASSET_FEED;
9+
10+
constructor(
11+
address assetAddress,
12+
address assetFeed,
13+
address customEngine
14+
) AaveV3Payload(IEngine(customEngine)) {
15+
ASSET_ADDRESS = assetAddress;
16+
ASSET_FEED = assetFeed;
17+
}
18+
19+
function newListings() public view override returns (IEngine.Listing[] memory) {
20+
IEngine.Listing[] memory listings = new IEngine.Listing[](1);
21+
22+
listings[0] = IEngine.Listing({
23+
asset: ASSET_ADDRESS,
24+
assetSymbol: '1INCH',
25+
priceFeed: ASSET_FEED,
26+
rateStrategyParams: IEngine.InterestRateInputData({
27+
optimalUsageRatio: 80_00,
28+
baseVariableBorrowRate: 25, // 0.25%
29+
variableRateSlope1: 3_00,
30+
variableRateSlope2: 75_00
31+
}),
32+
enabledToBorrow: EngineFlags.ENABLED,
33+
borrowableInIsolation: EngineFlags.DISABLED,
34+
withSiloedBorrowing: EngineFlags.DISABLED,
35+
flashloanable: EngineFlags.DISABLED,
36+
ltv: 82_50,
37+
liqThreshold: 86_00,
38+
liqBonus: 5_00,
39+
reserveFactor: 10_00,
40+
supplyCap: 85_000,
41+
borrowCap: 60_000,
42+
debtCeiling: 0,
43+
liqProtocolFee: 10_00
44+
});
45+
46+
return listings;
47+
}
48+
49+
function eModeCategoryCreations()
50+
public
51+
view
52+
override
53+
returns (IEngine.EModeCategoryCreation[] memory)
54+
{
55+
IEngine.EModeCategoryCreation[] memory eModeUpdates = new IEngine.EModeCategoryCreation[](1);
56+
57+
address[] memory collaterals = new address[](1);
58+
address[] memory borrowables = new address[](1);
59+
collaterals[0] = ASSET_ADDRESS;
60+
borrowables[0] = ASSET_ADDRESS;
61+
62+
eModeUpdates[0] = IEngine.EModeCategoryCreation({
63+
ltv: 97_40,
64+
liqThreshold: 97_60,
65+
liqBonus: 1_50,
66+
label: 'Listed Asset EMode',
67+
borrowables: borrowables,
68+
collaterals: collaterals
69+
});
70+
71+
return eModeUpdates;
72+
}
73+
74+
function getPoolContext() public pure override returns (IEngine.PoolContext memory) {
75+
return IEngine.PoolContext({networkName: 'Local', networkAbbreviation: 'Loc'});
76+
}
77+
}

0 commit comments

Comments
 (0)