@@ -22,9 +22,10 @@ import {
2222import { MintableERC20 } from '../types/MintableERC20' ;
2323import { Artifact } from 'hardhat/types' ;
2424import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types' ;
25- import { verifyContract } from './etherscan-verification' ;
25+ import { verifyEtherscanContract } from './etherscan-verification' ;
2626import { getIErc20Detailed } from './contracts-getters' ;
27- import { usingTenderly } from './tenderly-utils' ;
27+ import { usingTenderly , verifyAtTenderly } from './tenderly-utils' ;
28+ import { usingPolygon , verifyAtPolygon } from './polygon-utils' ;
2829
2930export type MockTokenMap = { [ symbol : string ] : MintableERC20 } ;
3031
@@ -98,18 +99,8 @@ export const withSaveAndVerify = async <ContractType extends Contract>(
9899) : Promise < ContractType > => {
99100 await waitForTx ( instance . deployTransaction ) ;
100101 await registerContractInJsonDb ( id , instance ) ;
101- if ( usingTenderly ( ) ) {
102- console . log ( ) ;
103- console . log ( 'Doing Tenderly contract verification of' , id ) ;
104- await ( DRE as any ) . tenderlyRPC . verify ( {
105- name : id ,
106- address : instance . address ,
107- } ) ;
108- console . log ( `Verified ${ id } at Tenderly!` ) ;
109- console . log ( ) ;
110- }
111102 if ( verify ) {
112- await verifyContract ( instance . address , args ) ;
103+ await verifyContract ( id , instance , args ) ;
113104 }
114105 return instance ;
115106} ;
@@ -327,3 +318,19 @@ export const buildFlashLiquidationAdapterParams = (
327318 [ collateralAsset , debtAsset , user , debtToCover , useEthPath ]
328319 ) ;
329320} ;
321+
322+ export const verifyContract = async (
323+ id : string ,
324+ instance : Contract ,
325+ args : ( string | string [ ] ) [ ]
326+ ) => {
327+ if ( usingPolygon ( ) ) {
328+ await verifyAtPolygon ( id , instance , args ) ;
329+ } else {
330+ if ( usingTenderly ( ) ) {
331+ await verifyAtTenderly ( id , instance ) ;
332+ }
333+ await verifyEtherscanContract ( instance . address , args ) ;
334+ }
335+ return instance ;
336+ } ;
0 commit comments