Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Moved optimal bandwidth to base forwarder #45

Merged
merged 4 commits into from
Feb 12, 2025
Merged
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
12 changes: 12 additions & 0 deletions src/templates/BaseForwarderAdaptersUpdate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ abstract contract BaseForwarderAdaptersUpdate is IBaseForwarderAdaptersUpdate {
return new ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[](0);
}

/// @inheritdoc IBaseForwarderAdaptersUpdate
function getOptimalBandwidthByChain() public view virtual returns (ICrossChainForwarder.OptimalBandwidthByChain[] memory) {
return new ICrossChainForwarder.OptimalBandwidthByChain[](0);
}

/// @inheritdoc IBaseForwarderAdaptersUpdate
function executeForwardersUpdate(address crossChainController) public virtual {
// remove forwarding adapters
Expand All @@ -43,5 +48,12 @@ abstract contract BaseForwarderAdaptersUpdate is IBaseForwarderAdaptersUpdate {
if (forwardersToEnable.length != 0) {
ICrossChainForwarder(crossChainController).enableBridgeAdapters(forwardersToEnable);
}

// update optimal bandwidth
ICrossChainForwarder.OptimalBandwidthByChain[]
memory optimalBandwidthByChain = getOptimalBandwidthByChain();
if (optimalBandwidthByChain.length != 0) {
ICrossChainForwarder(crossChainController).updateOptimalBandwidthByChain(optimalBandwidthByChain);
}
}
}
9 changes: 9 additions & 0 deletions src/templates/interfaces/IBaseForwarderAdaptersUpdate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ interface IBaseForwarderAdaptersUpdate {
view
returns (ICrossChainForwarder.ForwarderBridgeAdapterConfigInput[] memory);

/**
* @notice method to get the optimal bandwidth by chain
* @return object array with the chainId and the optimal bandwidth
*/
function getOptimalBandwidthByChain()
external
view
returns (ICrossChainForwarder.OptimalBandwidthByChain[] memory);

/**
* @notice method to add and remove forwarder adapters
* @param crossChainController address of the CCC on the networks where the adapters are going to be updated
Expand Down
Loading