diff --git a/contracts/base/GeneralMiddleware.sol b/contracts/base/GeneralMiddleware.sol index 3d00a7c4..1259411e 100644 --- a/contracts/base/GeneralMiddleware.sol +++ b/contracts/base/GeneralMiddleware.sol @@ -71,8 +71,8 @@ contract GeneralMiddleware is IbcMwUser, IbcMiddleware, IbcMwEventsEmitter, IbcM bytes32 destPortAddr, bytes calldata appData, uint64 timeoutTimestamp, - uint256[2] calldata gasLimits, - uint256[2] calldata gasPrices + uint256[2] memory gasLimits, + uint256[2] memory gasPrices ) external payable override returns (uint64 sequence) {} function sendMWPacket( diff --git a/contracts/examples/Mars.sol b/contracts/examples/Mars.sol index 9b3928ef..f4a7a532 100644 --- a/contracts/examples/Mars.sol +++ b/contracts/examples/Mars.sol @@ -92,15 +92,9 @@ contract Mars is IbcReceiverBase, IbcReceiver, FeeSender { /** * @notice Callback for acknowledging a packet; triggered on reciept of an IBC packet by the counterparty - * @param packet The IBC packet for which acknowledgement is received - * @param ack The acknowledgement packet received * @dev Make sure to validate packet's source and destiation channels and ports. */ - function onAcknowledgementPacket(IbcPacket calldata packet, AckPacket calldata ack) - external - virtual - onlyIbcDispatcher - { + function onAcknowledgementPacket(IbcPacket calldata, AckPacket calldata ack) external virtual onlyIbcDispatcher { ackPackets.push(ack); } @@ -119,14 +113,8 @@ contract Mars is IbcReceiverBase, IbcReceiver, FeeSender { * @notice Handles channel close callback on the dest chain * @param channelId The unique identifier of the channel * @dev Make sure to validate channelId and counterpartyVersion - * @param counterpartyPortId The unique identifier of the counterparty's port - * @param counterpartyChannelId The unique identifier of the counterparty's channel */ - function onChanCloseConfirm(bytes32 channelId, string calldata counterpartyPortId, bytes32 counterpartyChannelId) - external - virtual - onlyIbcDispatcher - { + function onChanCloseConfirm(bytes32 channelId, string calldata, bytes32) external virtual onlyIbcDispatcher { // logic to determine if the channel should be closed bool channelFound = false; for (uint256 i = 0; i < connectedChannels.length; i++) { @@ -182,8 +170,8 @@ contract Mars is IbcReceiverBase, IbcReceiver, FeeSender { string calldata message, bytes32 channelId, uint64 timeoutTimestamp, - uint256[2] calldata gasLimits, - uint256[2] calldata gasPrices + uint256[2] memory gasLimits, + uint256[2] memory gasPrices ) external payable returns (uint64 sequence) { sequence = dispatcher.sendPacket(channelId, bytes(message), timeoutTimestamp); _depositSendPacketFee(dispatcher, channelId, sequence, gasLimits, gasPrices); @@ -192,15 +180,15 @@ contract Mars is IbcReceiverBase, IbcReceiver, FeeSender { /** * @notice Handles the channel close init event * @dev Make sure to validate channelId and counterpartyVersion - * @param counterpartyPortIdentifier The unique identifier of the counterparty's channel * @param version The channel version */ - function onChanOpenInit( - ChannelOrder, - string[] calldata, - string calldata counterpartyPortIdentifier, - string calldata version - ) external view virtual onlyIbcDispatcher returns (string memory selectedVersion) { + function onChanOpenInit(ChannelOrder, string[] calldata, string calldata, string calldata version) + external + view + virtual + onlyIbcDispatcher + returns (string memory selectedVersion) + { return _openChannel(version); } diff --git a/contracts/implementation_templates/FeeSender.sol b/contracts/implementation_templates/FeeSender.sol index 1e204416..8da2550d 100644 --- a/contracts/implementation_templates/FeeSender.sol +++ b/contracts/implementation_templates/FeeSender.sol @@ -45,14 +45,16 @@ abstract contract FeeSender { * - gasPrices[1] for `ackPacket` fees, for the src chain * @notice The total fees sent in the msg.value should be equal to the total gasLimits[0] * gasPrices[0] + * @notice Use the Polymer fee estimation api to get the required fees to ensure that enough fees are sent. + * @dev Note: We have to have gasLimits and gasPrices as memory arrays. We cannot have them as calldata arrays + * because solidity has weird behavior with using too much calldata in stacked calls * gasLimits[1] * gasPrices[1]. The transaction will revert if a higher or lower value is sent */ function _depositSendPacketFee( IbcDispatcher dispatcher, bytes32 channelId, uint64 sequence, - uint256[2] calldata gasLimits, - uint256[2] calldata gasPrices + uint256[2] memory gasLimits, + uint256[2] memory gasPrices ) internal { dispatcher.feeVault().depositSendPacketFee{value: msg.value}(channelId, sequence, gasLimits, gasPrices); }