Skip to content

Commit

Permalink
add getFees func
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksiGer committed Dec 9, 2024
1 parent 23acefe commit bacb71d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions contracts/InfraOrchestrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,32 @@ contract InfraOrchestrator is
return _convertToUSDCDecimals(abi.decode(delegateCallRes, (uint256)));
}

/**
* @notice Function to get the total amount of fees in USDC
* @param dstChainSelector the destination blockchain chain selector
* @param amount the amount to calculate the fees for
* @return clfFees the amount of Chainlink functions fees in USDC
* @return ccipFees the amount of CCIP fees in USDC
* @return conceroFees the amount of Concero fees in USDC
*/
function getFees(
uint64 dstChainSelector,
uint256 amount
) external returns (uint256 clfFees, uint256 ccipFees, uint256 conceroFees) {
bytes memory delegateCallArgs = abi.encodeWithSelector(
IConceroBridge.getFees.selector,
dstChainSelector,
amount
);

bytes memory delegateCallRes = LibConcero.safeDelegateCall(
i_conceroBridge,
delegateCallArgs
);

return abi.decode(delegateCallRes, (uint256, uint256, uint256));
}

/**
* @notice Performs a bridge coupled with the source chain swap and an optional destination chain swap.
* @param bridgeData bridge payload of type BridgeData
Expand Down

0 comments on commit bacb71d

Please sign in to comment.