66 sendTransaction,
77} = require ( "../utils.js" ) ;
88
9- let deployer , deployedContracts , lender , ea , eaService , pdsService , treasury , ea_bcp ;
9+ let deployer ,
10+ deployedContracts ,
11+ lender ,
12+ ea ,
13+ eaService ,
14+ pdsService ,
15+ treasury ,
16+ ea_bcp ,
17+ baseCreditPoolOperator ,
18+ baseCreditPoolOwnerTreasury ;
1019
1120const HUMA_OWNER_ADRESS = "0x1931bD73055335Ba06efB22DB96169dbD4C5B4DB" ;
1221
@@ -232,12 +241,18 @@ async function initBaseCreditPoolConfig() {
232241 ] ) ;
233242 await sendTransaction ( "BaseCreditPoolConfig" , poolConfig , "setWithdrawalLockoutPeriod" , [ 1 ] ) ;
234243 await sendTransaction ( "BaseCreditPoolConfig" , poolConfig , "setPoolDefaultGracePeriod" , [ 60 ] ) ;
235- await sendTransaction ( "BaseCreditPoolConfig" , poolConfig , "addPoolOperator" , [
236- deployer . address ,
237- ] ) ;
238- await sendTransaction ( "BaseCreditPoolConfig" , poolConfig , "setPoolOwnerTreasury" , [
239- deployer . address ,
244+
245+ const poolConfigFromPoolOperator = await poolConfig . connect ( baseCreditPoolOperator ) ;
246+ await sendTransaction ( "BaseCreditPoolConfig" , poolConfigFromPoolOperator , "addPoolOperator" , [
247+ baseCreditPoolOperator . address ,
240248 ] ) ;
249+ const poolConfigFromOwnerTreasury = await poolConfig . connect ( baseCreditPoolOwnerTreasury ) ;
250+ await sendTransaction (
251+ "BaseCreditPoolConfig" ,
252+ poolConfigFromOwnerTreasury ,
253+ "setPoolOwnerTreasury" ,
254+ [ poolConfigFromOwnerTreasury . address ]
255+ ) ;
241256
242257 await updateInitilizedContract ( "BaseCreditPoolConfig" ) ;
243258}
@@ -277,10 +292,21 @@ async function prepareBaseCreditPool() {
277292
278293 const BaseCreditPool = await hre . ethers . getContractFactory ( "BaseCreditPool" ) ;
279294 const pool = BaseCreditPool . attach ( deployedContracts [ "BaseCreditPool" ] ) ;
295+ const poolFromPoolOperator = await pool . connect ( baseCreditPoolOperator ) ;
296+ const poolFromPoolOwnerTreasury = await pool . connect ( baseCreditPoolOwnerTreasury ) ;
280297
281- await sendTransaction ( "BaseCreditPool" , pool , "addApprovedLender" , [ deployer . address ] ) ;
282- await sendTransaction ( "BaseCreditPool" , pool , "addApprovedLender" , [ ea_bcp . address ] ) ;
283- await sendTransaction ( "BaseCreditPool" , pool , "addApprovedLender" , [ lender . address ] ) ;
298+ await sendTransaction ( "BaseCreditPool" , poolFromPoolOperator , "addApprovedLender" , [
299+ deployer . address ,
300+ ] ) ;
301+ await sendTransaction ( "BaseCreditPool" , poolFromPoolOperator , "addApprovedLender" , [
302+ ea_bcp . address ,
303+ ] ) ;
304+ await sendTransaction ( "BaseCreditPool" , poolFromPoolOperator , "addApprovedLender" , [
305+ lender . address ,
306+ ] ) ;
307+ await sendTransaction ( "BaseCreditPool" , poolFromPoolOperator , "addApprovedLender" , [
308+ baseCreditPoolOwnerTreasury . address ,
309+ ] ) ;
284310
285311 const USDC = await hre . ethers . getContractFactory ( "TestToken" ) ;
286312 const usdc = USDC . attach ( deployedContracts [ "USDC" ] ) ;
@@ -290,7 +316,9 @@ async function prepareBaseCreditPool() {
290316 const amountOwner = BN . from ( 20_000 ) . mul ( BN . from ( 10 ) . pow ( BN . from ( decimals ) ) ) ;
291317 await sendTransaction ( "TestToken" , usdc , "mint" , [ deployer . address , amountOwner ] ) ;
292318 await sendTransaction ( "TestToken" , usdc , "approve" , [ pool . address , amountOwner ] ) ;
293- await sendTransaction ( "BaseCreditPool" , pool , "makeInitialDeposit" , [ amountOwner ] ) ;
319+ await sendTransaction ( "BaseCreditPool" , poolFromPoolOwnerTreasury , "makeInitialDeposit" , [
320+ amountOwner ,
321+ ] ) ;
294322
295323 // EA
296324 const usdcFromEA = await usdc . connect ( ea_bcp ) ;
@@ -307,7 +335,18 @@ async function initContracts() {
307335 const network = ( await hre . ethers . provider . getNetwork ( ) ) . name ;
308336 console . log ( "network : " , network ) ;
309337 const accounts = await hre . ethers . getSigners ( ) ;
310- [ deployer , proxyOwner , lender , ea , eaService , pdsService , treasury , ea_bcp ] = await accounts ;
338+ [
339+ deployer ,
340+ proxyOwner ,
341+ lender ,
342+ ea ,
343+ eaService ,
344+ pdsService ,
345+ treasury ,
346+ ea_bcp ,
347+ baseCreditPoolOperator ,
348+ baseCreditPoolOwnerTreasury ,
349+ ] = await accounts ;
311350 console . log ( "deployer address: " + deployer . address ) ;
312351 console . log ( "lender address: " + lender . address ) ;
313352 console . log ( "ea address: " + ea . address ) ;
0 commit comments