Skip to content

Commit

Permalink
fix sonarqube
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFan1992 committed Feb 19, 2024
1 parent cd2f54c commit da8cd67
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions integration-tests/contracts/ethereum_keeper_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,29 +271,7 @@ func (rcs *KeeperRegistrySettings) EncodeOnChainConfig(registrar string, registr
return nil, err
}

onchainConfigStruct := automation_registry_wrapper_2_2.AutomationRegistryBase22OnchainConfig{
PaymentPremiumPPB: rcs.PaymentPremiumPPB,
FlatFeeMicroLink: rcs.FlatFeeMicroLINK,
CheckGasLimit: rcs.CheckGasLimit,
StalenessSeconds: rcs.StalenessSeconds,
GasCeilingMultiplier: rcs.GasCeilingMultiplier,
MinUpkeepSpend: rcs.MinUpkeepSpend,
MaxPerformGas: rcs.MaxPerformGas,
MaxCheckDataSize: rcs.MaxCheckDataSize,
MaxPerformDataSize: rcs.MaxPerformDataSize,
MaxRevertDataSize: uint32(1000),
FallbackGasPrice: rcs.FallbackGasPrice,
FallbackLinkPrice: rcs.FallbackLinkPrice,
Transcoder: common.Address{},
Registrars: []common.Address{common.HexToAddress(registrar)},
UpkeepPrivilegeManager: registryOwnerAddress,
ChainModule: *chainModuleBaseAddr,
ReorgProtectionEnabled: true,
}

encodedOnchainConfig, err := utilsABI22.Methods["_onChainConfig"].Inputs.Pack(&onchainConfigStruct)

return encodedOnchainConfig, err
return rcs.encode22OnchainConfig(registrar, registryOwnerAddress, *chainModuleBaseAddr)
}
configType := goabi.MustNewType("tuple(uint32 paymentPremiumPPB,uint32 flatFeeMicroLink,uint32 checkGasLimit,uint24 stalenessSeconds,uint16 gasCeilingMultiplier,uint96 minUpkeepSpend,uint32 maxPerformGas,uint32 maxCheckDataSize,uint32 maxPerformDataSize,uint256 fallbackGasPrice,uint256 fallbackLinkPrice,address transcoder,address registrar)")
onchainConfig, err := goabi.Encode(map[string]interface{}{
Expand All @@ -315,6 +293,32 @@ func (rcs *KeeperRegistrySettings) EncodeOnChainConfig(registrar string, registr

}

func (rcs *KeeperRegistrySettings) encode22OnchainConfig(registrar string, registryOwnerAddress, chainModuleBaseAddr common.Address) ([]byte, error) {
onchainConfigStruct := automation_registry_wrapper_2_2.AutomationRegistryBase22OnchainConfig{
PaymentPremiumPPB: rcs.PaymentPremiumPPB,
FlatFeeMicroLink: rcs.FlatFeeMicroLINK,
CheckGasLimit: rcs.CheckGasLimit,
StalenessSeconds: rcs.StalenessSeconds,
GasCeilingMultiplier: rcs.GasCeilingMultiplier,
MinUpkeepSpend: rcs.MinUpkeepSpend,
MaxPerformGas: rcs.MaxPerformGas,
MaxCheckDataSize: rcs.MaxCheckDataSize,
MaxPerformDataSize: rcs.MaxPerformDataSize,
MaxRevertDataSize: uint32(1000),
FallbackGasPrice: rcs.FallbackGasPrice,
FallbackLinkPrice: rcs.FallbackLinkPrice,
Transcoder: common.Address{},
Registrars: []common.Address{common.HexToAddress(registrar)},
UpkeepPrivilegeManager: registryOwnerAddress,
ChainModule: chainModuleBaseAddr,
ReorgProtectionEnabled: true,
}

encodedOnchainConfig, err := utilsABI22.Methods["_onChainConfig"].Inputs.Pack(&onchainConfigStruct)

return encodedOnchainConfig, err
}

func (v *EthereumKeeperRegistry) RegistryOwnerAddress() common.Address {
callOpts := &bind.CallOpts{
Pending: false,
Expand Down

0 comments on commit da8cd67

Please sign in to comment.