feat: add quoteGasPayment to ICA router (#3460)

### Description

- for easier offchain use, we can directly call the ICA router to fetch
the quote needed for the dispatch.

### Drive-by changes

None

### Related issues

None

### Backward compatibility

Yes

### Testing

Unit
pull/3494/head
Kunal Arora 7 months ago committed by GitHub
parent 1af0babdec
commit 4f0ea4361e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      solidity/contracts/middleware/InterchainAccountRouter.sol
  2. 12
      solidity/test/InterchainAccountRouter.t.sol

@ -656,4 +656,15 @@ contract InterchainAccountRouter is Router {
) private view returns (address payable) {
return payable(Create2.computeAddress(_salt, bytecodeHash));
}
/**
* @notice Returns the gas payment required to dispatch a message to the given domain's router.
* @param _destination The domain of the destination router.
* @return _gasPayment Payment computed by the registered hooks via MailboxClient.
*/
function quoteGasPayment(
uint32 _destination
) external view returns (uint256 _gasPayment) {
return _quoteDispatch(_destination, "");
}
}

@ -339,6 +339,18 @@ contract InterchainAccountRouterTest is Test {
assertEq(ownerBytes, owner.addressToBytes32());
}
function test_quoteGasPayment() public {
// arrange
originRouter.enrollRemoteRouterAndIsm(
destination,
routerOverride,
ismOverride
);
// assert
assertEq(originRouter.quoteGasPayment(destination), gasPaymentQuote);
}
function testFuzz_singleCallRemoteWithDefault(bytes32 data) public {
// arrange
originRouter.enrollRemoteRouterAndIsm(

Loading…
Cancel
Save