Skip to content

Commit b6cc2ee

Browse files
committed
replace code on wallet implementation address
1 parent b933c6a commit b6cc2ee

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

estimator.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,18 @@ func V2Simulate(provider *ethrpc.Provider, wallet common.Address, transactions T
603603
Data: hexutil.Encode(callData),
604604
}
605605

606+
encodedImpAddr, err := provider.ContractQuery(context.Background(), wallet.Hex(), "PROXY_getImplementation()", "address", nil)
607+
if err != nil {
608+
return nil, err
609+
}
610+
if len(encodedImpAddr) == 0 {
611+
return nil, fmt.Errorf("cannot get implementation address of wallet %v", wallet.Hex())
612+
}
613+
614+
impAddr := common.HexToAddress(encodedImpAddr[0])
615+
606616
allOverrides := map[common.Address]*CallOverride{
607-
wallet: {Code: walletGasEstimatorCodeV2},
617+
impAddr: {Code: walletGasEstimatorCodeV2},
608618
}
609619
for address, override := range overrides {
610620
if address == wallet {

0 commit comments

Comments
 (0)