@@ -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} ;
@@ -328,3 +319,19 @@ export const buildFlashLiquidationAdapterParams = (
328319 [ collateralAsset , debtAsset , user , debtToCover , useEthPath ]
329320 ) ;
330321} ;
322+
323+ export const verifyContract = async (
324+ id : string ,
325+ instance : Contract ,
326+ args : ( string | string [ ] ) [ ]
327+ ) => {
328+ if ( usingPolygon ( ) ) {
329+ await verifyAtPolygon ( id , instance , args ) ;
330+ } else {
331+ if ( usingTenderly ( ) ) {
332+ await verifyAtTenderly ( id , instance ) ;
333+ }
334+ await verifyEtherscanContract ( instance . address , args ) ;
335+ }
336+ return instance ;
337+ } ;
0 commit comments