1
1
import { Address } from "viem" ;
2
- import { LiquidatorsRegistryConfigFnParams } from "../../../chains/ types" ;
3
- import { chainIdToConfig } from "../../../chains" ;
2
+ import { LiquidatorsRegistryConfigFnParams } from "../../types" ;
3
+ import { chainIdToConfig } from "../../../../monorepo/packages/ chains/src " ;
4
4
5
5
export const configureLiquidatorsRegistry = async ( {
6
6
viem,
7
- getNamedAccounts,
8
7
chainId,
9
8
deployments
10
9
} : LiquidatorsRegistryConfigFnParams ) : Promise < void > => {
@@ -24,7 +23,7 @@ export const configureLiquidatorsRegistry = async ({
24
23
for ( const redemptionStrategy of chainIdToConfig [ chainId ] . redemptionStrategies ) {
25
24
const { strategy, outputToken, inputToken } = redemptionStrategy ;
26
25
const redemptionStrategyContract = await viem . getContractAt (
27
- strategy ,
26
+ strategy as string ,
28
27
( await deployments . get ( strategy ) ) . address as Address
29
28
) ;
30
29
@@ -33,12 +32,16 @@ export const configureLiquidatorsRegistry = async ({
33
32
outputTokens . push ( outputToken ) ;
34
33
}
35
34
const matchingStrategies = await liquidatorsRegistry . read . pairsStrategiesMatch ( [
36
- strategies ,
37
- inputTokens ,
38
- outputTokens
35
+ strategies as Address [ ] ,
36
+ inputTokens as Address [ ] ,
37
+ outputTokens as Address [ ]
39
38
] ) ;
40
39
if ( ! matchingStrategies ) {
41
- const hash = await liquidatorsRegistry . write . _resetRedemptionStrategies ( [ strategies , inputTokens , outputTokens ] ) ;
40
+ const hash = await liquidatorsRegistry . write . _resetRedemptionStrategies ( [
41
+ strategies as Address [ ] ,
42
+ inputTokens as Address [ ] ,
43
+ outputTokens as Address [ ]
44
+ ] ) ;
42
45
console . log ( "waiting for tx " , hash ) ;
43
46
await publicClient . waitForTransactionReceipt ( { hash } ) ;
44
47
console . log ( "_resetRedemptionStrategies: " , hash ) ;
@@ -61,10 +64,18 @@ export const configureLiquidatorsRegistry = async ({
61
64
}
62
65
}
63
66
64
- const matchingFees = await liquidatorsRegistry . read . uniswapPairsFeesMatch ( [ inputTokens , outputTokens , fees ] ) ;
67
+ const matchingFees = await liquidatorsRegistry . read . uniswapPairsFeesMatch ( [
68
+ inputTokens as Address [ ] ,
69
+ outputTokens as Address [ ] ,
70
+ fees . map ( ( f ) => BigInt ( f ) )
71
+ ] ) ;
65
72
66
73
if ( ! matchingFees ) {
67
- const hash = await liquidatorsRegistry . write . _setUniswapV3Fees ( [ inputTokens , outputTokens , fees ] ) ;
74
+ const hash = await liquidatorsRegistry . write . _setUniswapV3Fees ( [
75
+ inputTokens as Address [ ] ,
76
+ outputTokens as Address [ ] ,
77
+ fees
78
+ ] ) ;
68
79
console . log ( "waiting for tx " , hash ) ;
69
80
await publicClient . waitForTransactionReceipt ( { hash } ) ;
70
81
console . log ( "_setUniswapV3Fees: " , hash ) ;
@@ -91,13 +102,17 @@ export const configureLiquidatorsRegistry = async ({
91
102
}
92
103
93
104
const matchingRouters = await liquidatorsRegistry . read . uniswapPairsRoutersMatch ( [
94
- inputTokens ,
95
- outputTokens ,
96
- routers
105
+ inputTokens as Address [ ] ,
106
+ outputTokens as Address [ ] ,
107
+ routers as Address [ ]
97
108
] ) ;
98
109
99
110
if ( ! matchingRouters ) {
100
- const hash = await liquidatorsRegistry . write . _setUniswapV3Routers ( [ inputTokens , outputTokens , routers ] ) ;
111
+ const hash = await liquidatorsRegistry . write . _setUniswapV3Routers ( [
112
+ inputTokens as Address [ ] ,
113
+ outputTokens as Address [ ] ,
114
+ routers as Address [ ]
115
+ ] ) ;
101
116
console . log ( "waiting for tx " , hash ) ;
102
117
await publicClient . waitForTransactionReceipt ( { hash } ) ;
103
118
console . log ( "_setUniswapV3Router: " , hash ) ;
0 commit comments