Skip to content

Commit dfcc124

Browse files
yan-mannisnislevi
andauthored
feat: liquidation data provider deployment script (#32)
* feat: liquidation data provider deployment script * fix: CI * fix: Certora CI (#33) * chore: lint * chore: lint * test: clean up makefile; add fork test; pr comments --------- Co-authored-by: Nissan Levi <[email protected]>
1 parent 2319c16 commit dfcc124

File tree

8 files changed

+86
-15
lines changed

8 files changed

+86
-15
lines changed

.github/workflows/certora-basic.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ concurrency:
77
on:
88
pull_request:
99
branches:
10-
- main
11-
- certora
10+
- "**"
1211
push:
1312
branches:
1413
- main
@@ -18,13 +17,14 @@ on:
1817
jobs:
1918
verify:
2019
runs-on: ubuntu-latest
21-
if:
22-
github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'push' &&
23-
github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
20+
# if:
21+
# github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'push' &&
22+
# github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
2423
permissions:
2524
contents: read
2625
statuses: write
2726
pull-requests: write
27+
id-token: write
2828
steps:
2929
- uses: actions/checkout@v4
3030
with:
@@ -36,7 +36,7 @@ jobs:
3636
touch applyHarness.patch
3737
make munged
3838
39-
- uses: Certora/certora-run-action@v1
39+
- uses: Certora/certora-run-action@v2
4040
with:
4141
cli-version: 7.29.1
4242
configurations: |-

.github/workflows/certora-stata.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ concurrency:
77
on:
88
pull_request:
99
branches:
10-
- main
11-
- certora
10+
- "**"
1211
push:
1312
branches:
1413
- main
@@ -18,13 +17,14 @@ on:
1817
jobs:
1918
verify:
2019
runs-on: ubuntu-latest
21-
if:
22-
github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'push' &&
23-
github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
20+
# if:
21+
# github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'push' &&
22+
# github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
2423
permissions:
2524
contents: read
2625
statuses: write
2726
pull-requests: write
27+
id-token: write
2828
steps:
2929
- uses: actions/checkout@v4
3030
with:
@@ -36,7 +36,7 @@ jobs:
3636
touch applyHarness.patch
3737
make munged
3838
39-
- uses: Certora/certora-run-action@v1
39+
- uses: Certora/certora-run-action@v2
4040
with:
4141
cli-version: 7.29.1
4242
configurations: |-

.github/workflows/dependency-review.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Dependency Review'
1+
name: "Dependency Review"
22
on: [pull_request]
33

44
permissions:
@@ -9,9 +9,9 @@ jobs:
99
dependency-review:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: 'Checkout Repository'
12+
- name: "Checkout Repository"
1313
uses: actions/checkout@v5
14-
- name: 'Dependency Review'
14+
- name: "Dependency Review"
1515
uses: actions/dependency-review-action@v4
1616
with:
1717
comment-summary-in-pr: on-failure

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ deploy-phase-one-update-payload :;
8484
--sig "run()" \
8585
--verify --broadcast
8686

87+
# Deploy liquidation data provider. `make deploy-liquidation-data-provider CHAIN=mainnet ACCOUNT=<account>`
88+
deploy-liquidation-data-provider :;
89+
FOUNDRY_PROFILE=${CHAIN} forge script scripts/misc/DeployLiquidationDataProvider.sol:DeployLiquidationDataProvider \
90+
--rpc-url ${CHAIN} --account ${ACCOUNT} --slow --gas-estimate-multiplier 150 \
91+
--chain ${CHAIN} --verifier-url ${VERIFIER_URL} \
92+
--sig "run(address,address)" ${pool} ${addressesProvider} \
93+
--verify --broadcast
94+
8795
# Invariants
8896
echidna:
8997
echidna tests/invariants/Tester.t.sol --contract Tester --config ./tests/invariants/_config/echidna_config.yaml --corpus-dir ./tests/invariants/_corpus/echidna/default/_data/corpus
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import {LiquidationDataProvider} from '../../src/contracts/helpers/LiquidationDataProvider.sol';
5+
import {Script} from 'forge-std/Script.sol';
6+
7+
contract DeployLiquidationDataProvider is Script {
8+
function run(address pool, address addressesProvider) public returns (address) {
9+
vm.startBroadcast();
10+
LiquidationDataProvider liquidationDataProvider = new LiquidationDataProvider(
11+
pool,
12+
addressesProvider
13+
);
14+
vm.stopBroadcast();
15+
return address(liquidationDataProvider);
16+
}
17+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.0;
3+
4+
import {Test} from 'forge-std/Test.sol';
5+
import {DeployLiquidationDataProvider} from '../../scripts/misc/DeployLiquidationDataProvider.sol';
6+
import {ILiquidationDataProvider} from '../../src/contracts/helpers/interfaces/ILiquidationDataProvider.sol';
7+
8+
contract DeployLiquidationDataProviderForkTest is Test {
9+
address public constant POOL = 0xAe05Cd22df81871bc7cC2a04BeCfb516bFe332C8;
10+
address public constant ADDRESSES_PROVIDER = 0x5D39E06b825C1F2B80bf2756a73e28eFAA128ba0;
11+
12+
DeployLiquidationDataProvider internal deployLiquidationDataProvider;
13+
ILiquidationDataProvider internal liquidationDataProvider;
14+
15+
function setUp() public virtual {
16+
vm.createSelectFork('mainnet', 23420687);
17+
18+
deployLiquidationDataProvider = new DeployLiquidationDataProvider();
19+
liquidationDataProvider = ILiquidationDataProvider(
20+
deployLiquidationDataProvider.run(POOL, ADDRESSES_PROVIDER)
21+
);
22+
}
23+
24+
function test_getUserPositionFullInfo() public view {
25+
address user = 0xFf09aAD651888ceFAd81271a79b4Ef7dEC245F49; // sample user with USDC debt
26+
address USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
27+
ILiquidationDataProvider.UserPositionFullInfo memory userInfo = liquidationDataProvider
28+
.getUserPositionFullInfo(user);
29+
30+
assertGt(userInfo.healthFactor, 1e18); // healthy health factor
31+
32+
ILiquidationDataProvider.DebtFullInfo memory debtInfo = liquidationDataProvider.getDebtFullInfo(
33+
user,
34+
USDC
35+
);
36+
37+
assertGt(debtInfo.debtBalanceInBaseCurrency, 0);
38+
}
39+
40+
function test_deployLiquidationDataProvider() public view {
41+
assertEq(address(liquidationDataProvider.POOL()), POOL);
42+
assertEq(address(liquidationDataProvider.ADDRESSES_PROVIDER()), ADDRESSES_PROVIDER);
43+
}
44+
}

tests/deployments/HorizonPhaseOneListing.t.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ abstract contract HorizonListingMainnetTest is HorizonListingBaseTest {
822822
});
823823

824824
function setUp() public virtual {
825+
vm.skip(true);
825826
vm.createSelectFork('mainnet');
826827
initEnvironment();
827828
}

tests/deployments/HorizonPhaseOneUpdate.t.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ contract HorizonPhaseOneUpdateTest is HorizonPhaseOneListingTest {
4141
}
4242

4343
function setUp() public virtual override {
44+
vm.skip(true);
4445
super.setUp();
4546
loadUpdatedParams();
4647
}

0 commit comments

Comments
 (0)