Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 19 additions & 27 deletions ccv/chains/evm/deployment/v2_0_0/sequences/fee_quoter.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ var (
fqops.Version,
"",
)
isNewFQ17Deployment := datastore_utils.IsAddressRefEmpty(feeQuoterRef)
isNewFQ20Deployment := datastore_utils.IsAddressRefEmpty(feeQuoterRef)
tokenTransferFeeConfigArgs := make([]fqops.TokenTransferFeeConfigArgs, 0)
allDestChainConfigs := make([]fqops.DestChainConfigArgs, 0)
for remoteChain, cfg := range fqOutput.RemoteChainCfgs {
Expand Down Expand Up @@ -264,25 +264,21 @@ var (
})
allDestChainConfigs = append(allDestChainConfigs, outDestchainCfg)
}
if isNewFQ17Deployment {
if isNewFQ20Deployment {
output.ConstructorArgs = fqops.ConstructorArgs{
StaticConfig: fqops.StaticConfig{
LinkToken: fqOutput.StaticCfg.LinkToken,
MaxFeeJuelsPerMsg: fqOutput.StaticCfg.MaxFeeJuelsPerMsg,
},
PriceUpdaters: fqOutput.PriceUpdaters,
TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgs,
DestChainConfigArgs: allDestChainConfigs,
}
} else {
output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{
AddedCallers: fqOutput.PriceUpdaters,
}
output.TokenTransferFeeConfigUpdates = fqops.ApplyTokenTransferFeeConfigUpdatesArgs{
TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgs,
}
output.DestChainConfigs = allDestChainConfigs
}
output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{
AddedCallers: fqOutput.PriceUpdaters,
}
output.TokenTransferFeeConfigUpdates = fqops.ApplyTokenTransferFeeConfigUpdatesArgs{
TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgs,
}
output.DestChainConfigs = allDestChainConfigs
Comment on lines +275 to +281
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? it's already handled in else part

return output, nil
})

Expand Down Expand Up @@ -346,7 +342,7 @@ var (
fqops.Version,
"",
)
isNewFQ17Deployment := datastore_utils.IsAddressRefEmpty(feeQuoter17Ref)
isNewFQ20Deployment := datastore_utils.IsAddressRefEmpty(feeQuoter17Ref)
var staticCfg fqops.StaticConfig
var destChainCfgs []fqops.DestChainConfigArgs
var tokenTransferFeeConfigArgs []fqops.TokenTransferFeeConfigSingleTokenArgs
Expand Down Expand Up @@ -403,23 +399,19 @@ var (
TokenTransferFeeConfigs: tokenTransferFeeConfigArgs,
})
}
if isNewFQ17Deployment {
if isNewFQ20Deployment {
output.ConstructorArgs = fqops.ConstructorArgs{
StaticConfig: fqops.StaticConfig{
LinkToken: staticCfg.LinkToken,
MaxFeeJuelsPerMsg: staticCfg.MaxFeeJuelsPerMsg,
},
DestChainConfigArgs: destChainCfgs,
TokenTransferFeeConfigArgs: tokenTransferFeeConfigArgsForAll,
PriceUpdaters: priceUpdaters,
}
} else {
output.DestChainConfigs = destChainCfgs
output.TokenTransferFeeConfigUpdates.TokenTransferFeeConfigArgs = tokenTransferFeeConfigArgsForAll
output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{
AddedCallers: priceUpdaters,
}
}
output.DestChainConfigs = destChainCfgs
output.TokenTransferFeeConfigUpdates.TokenTransferFeeConfigArgs = tokenTransferFeeConfigArgsForAll
output.AuthorizedCallerUpdates = fqops.AuthorizedCallerArgs{
AddedCallers: priceUpdaters,
}
return output, nil
})
)
Expand Down Expand Up @@ -538,6 +530,9 @@ func mergePriceUpdaters(updaters1, updaters2 fqops.AuthorizedCallerArgs) fqops.A
}

func mergeDestChainConfigs(cfgs1, cfgs2 []fqops.DestChainConfigArgs) []fqops.DestChainConfigArgs {
if len(cfgs1) == 0 {
return cfgs2
}
// Create a map of dest chain selectors from cfgs1
destChainMap := make(map[uint64]fqops.DestChainConfigArgs)
for _, cfg := range cfgs1 {
Expand All @@ -551,9 +546,6 @@ func mergeDestChainConfigs(cfgs1, cfgs2 []fqops.DestChainConfigArgs) []fqops.Des
}
// If it exists in both, cfgs1's value is already used (takes precedence)
}
if len(destChainMap) == 0 {
return nil
}
return result
}

Expand Down
Loading
Loading