@@ -23,9 +23,10 @@ import { MintableERC20 } from '../types/MintableERC20';
2323import { Artifact } from 'hardhat/types' ;
2424import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types' ;
2525import { verifyEtherscanContract } from './etherscan-verification' ;
26- import { getIErc20Detailed } from './contracts-getters' ;
26+ import { getFirstSigner , getIErc20Detailed } from './contracts-getters' ;
2727import { usingTenderly , verifyAtTenderly } from './tenderly-utils' ;
2828import { usingPolygon , verifyAtPolygon } from './polygon-utils' ;
29+ import { getDefenderRelaySigner , usingDefender } from './defender-utils' ;
2930
3031export type MockTokenMap = { [ symbol : string ] : MintableERC20 } ;
3132
@@ -66,11 +67,18 @@ export const rawInsertContractAddressInDb = async (id: string, address: tEthereu
6667 } )
6768 . write ( ) ;
6869
69- export const getEthersSigners = async ( ) : Promise < Signer [ ] > =>
70- await Promise . all ( await DRE . ethers . getSigners ( ) ) ;
70+ export const getEthersSigners = async ( ) : Promise < Signer [ ] > => {
71+ const ethersSigners = await Promise . all ( await DRE . ethers . getSigners ( ) ) ;
72+
73+ if ( usingDefender ( ) ) {
74+ const [ , ...users ] = ethersSigners ;
75+ return [ await getDefenderRelaySigner ( ) , ...users ] ;
76+ }
77+ return ethersSigners ;
78+ } ;
7179
7280export const getEthersSignersAddresses = async ( ) : Promise < tEthereumAddress [ ] > =>
73- await Promise . all ( ( await DRE . ethers . getSigners ( ) ) . map ( ( signer ) => signer . getAddress ( ) ) ) ;
81+ await Promise . all ( ( await getEthersSigners ( ) ) . map ( ( signer ) => signer . getAddress ( ) ) ) ;
7482
7583export const getCurrentBlock = async ( ) => {
7684 return DRE . ethers . provider . getBlockNumber ( ) ;
@@ -83,9 +91,9 @@ export const deployContract = async <ContractType extends Contract>(
8391 contractName : string ,
8492 args : any [ ]
8593) : Promise < ContractType > => {
86- const contract = ( await ( await DRE . ethers . getContractFactory ( contractName ) ) . deploy (
87- ... args
88- ) ) as ContractType ;
94+ const contract = ( await ( await DRE . ethers . getContractFactory ( contractName ) )
95+ . connect ( await getFirstSigner ( ) )
96+ . deploy ( ... args ) ) as ContractType ;
8997 await waitForTx ( contract . deployTransaction ) ;
9098 await registerContractInJsonDb ( < eContractid > contractName , contract ) ;
9199 return contract ;
0 commit comments