@@ -648,38 +648,42 @@ async function processInitForm(
648
648
initDebugger . extend ( 'processInitForm' ) ( "abiFromEtherscan len: '%s'" , abiFromApi ?. name ) ;
649
649
} else {
650
650
abiFromApi = initAbi ;
651
- const isProxy =
652
- abiFromApi ?. callFunctions ( ) . some ( entry => entry . get ( 'name' ) === 'implementation' ) ??
653
- false ;
654
- initDebugger . extend ( 'processInitForm' ) ( 'isProxy: %O' , isProxy ) ;
655
- if ( isProxy ) {
656
- const impl = await retryWithPrompt ( ( ) =>
657
- withSpinner (
658
- 'Fetching proxy implementation address...' ,
659
- 'Failed to fetch proxy implementation address' ,
660
- 'Warning fetching proxy implementation address' ,
661
- ( ) => contractService . getProxyImplementation ( network . id , address ) ,
662
- ) ,
651
+ }
652
+
653
+ const isProxy =
654
+ abiFromApi
655
+ ?. callFunctions ( )
656
+ . some (
657
+ entry => entry . get ( 'name' ) === 'implementation' || entry . get ( 'name' ) === 'upgradeTo' ,
658
+ ) ?? false ;
659
+ initDebugger . extend ( 'processInitForm' ) ( 'isProxy: %O' , isProxy ) ;
660
+
661
+ if ( isProxy ) {
662
+ const impl = await retryWithPrompt ( ( ) =>
663
+ withSpinner (
664
+ 'Fetching proxy implementation address...' ,
665
+ 'Failed to fetch proxy implementation address' ,
666
+ 'Warning fetching proxy implementation address' ,
667
+ ( ) => contractService . getProxyImplementation ( network . id , address ) ,
668
+ ) ,
669
+ ) ;
670
+ initDebugger . extend ( 'processInitForm' ) ( "proxyImplementation: '%s'" , impl ) ;
671
+ if ( impl ) {
672
+ const useImplementation = await prompt . confirm (
673
+ `Proxy contract detected. Index implementation contract at ${ impl } ?` ,
674
+ true ,
663
675
) ;
664
- initDebugger . extend ( 'processInitForm' ) ( "proxyImplementation: '%s'" , impl ) ;
665
- if ( impl ) {
666
- const useImplementation = await prompt . confirm (
667
- `Proxy contract detected. Index implementation contract at ${ impl } ?` ,
668
- true ,
669
- ) ;
670
676
671
- if ( useImplementation ) {
672
- implAddress = impl ;
673
- abiFromApi = await retryWithPrompt ( ( ) =>
674
- withSpinner (
675
- 'Fetching implementation contract ABI...' ,
676
- 'Failed to fetch implementation ABI' ,
677
- 'Warning fetching implementation ABI' ,
678
- ( ) =>
679
- contractService . getABI ( protocolInstance . getABI ( ) , network . id , implAddress ! ) ,
680
- ) ,
681
- ) ;
682
- }
677
+ if ( useImplementation ) {
678
+ implAddress = impl ;
679
+ abiFromApi = await retryWithPrompt ( ( ) =>
680
+ withSpinner (
681
+ 'Fetching implementation contract ABI...' ,
682
+ 'Failed to fetch implementation ABI' ,
683
+ 'Warning fetching implementation ABI' ,
684
+ ( ) => contractService . getABI ( protocolInstance . getABI ( ) , network . id , implAddress ! ) ,
685
+ ) ,
686
+ ) ;
683
687
}
684
688
}
685
689
}
@@ -1338,7 +1342,7 @@ async function addAnotherContract(
1338
1342
name : 'contract' ,
1339
1343
initial : ProtocolContract . identifierName ( ) ,
1340
1344
required : true ,
1341
- message : ( ) => `\nContract ${ ProtocolContract . identifierName ( ) } ` ,
1345
+ message : ( ) => `Contract ${ ProtocolContract . identifierName ( ) } ` ,
1342
1346
validate : value => {
1343
1347
const { valid, error } = validateContract ( value , ProtocolContract ) ;
1344
1348
return valid ? true : error ;
0 commit comments