|
1 | 1 | // SPDX-License-Identifier: Apache-2.0 |
2 | 2 | pragma solidity ^0.8.20; |
3 | 3 |
|
4 | | -import {Channel, UpgradeFields, Timeout} from "../../../../contracts/proto/Channel.sol"; |
5 | | -import {IIBCHandler} from "../../../../contracts/core/25-handler/IIBCHandler.sol"; |
6 | | -import {IIBCModuleUpgrade} from "../../../../contracts/core/26-router/IIBCModuleUpgrade.sol"; |
7 | | -import {AppBase} from "../../../../contracts/apps/commons/IBCAppBase.sol"; |
8 | | - |
9 | | -interface IIBCChannelUpgradableModuleErrors { |
10 | | - // ------------------- Errors ------------------- // |
11 | | - |
12 | | - error IBCChannelUpgradableModuleUnauthorizedUpgrader(); |
13 | | - error IBCChannelUpgradableModuleInvalidTimeout(); |
14 | | - error IBCChannelUpgradableModuleInvalidConnectionHops(); |
15 | | - error IBCChannelUpgradableModuleUpgradeAlreadyExists(); |
16 | | - error IBCChannelUpgradableModuleUpgradeNotFound(); |
17 | | - error IBCChannelUpgradableModuleInvalidUpgrade(); |
18 | | - |
19 | | - error IBCChannelUpgradableModuleCannotRemoveInProgressUpgrade(); |
20 | | - /// @param state The current state of the channel |
21 | | - error IBCChannelUpgradableModuleChannelNotFlushingState(Channel.State state); |
22 | | - /// @param actual The actual upgrade sequence |
23 | | - error IBCChannelUpgradableModuleSequenceMismatch(uint64 actual); |
24 | | - |
25 | | - error IBCChannelUpgradableModuleChannelNotFound(); |
26 | | - error IBCChannelUpgradableModuleCannotOverwriteUpgrade(); |
27 | | -} |
28 | | - |
29 | | -interface IIBCChannelUpgradableModule { |
30 | | - // ------------------- Data Structures ------------------- // |
31 | | - |
32 | | - /** |
33 | | - * @dev Proposed upgrade fields |
34 | | - * @param fields Upgrade fields |
35 | | - * @param timeout Absolute timeout for the upgrade |
36 | | - */ |
37 | | - struct UpgradeProposal { |
38 | | - UpgradeFields.Data fields; |
39 | | - Timeout.Data timeout; |
40 | | - } |
41 | | - |
42 | | - /** |
43 | | - * @dev Allowed transition for the channel upgrade |
44 | | - * @param flushComplete Whether the upgrade is allowed to transition to the flush complete state |
45 | | - */ |
46 | | - struct AllowedTransition { |
47 | | - bool flushComplete; |
48 | | - } |
49 | | - |
50 | | - // ------------------- Functions ------------------- // |
51 | | - |
52 | | - /** |
53 | | - * @dev Returns the proposed upgrade for the given port, channel, and sequence |
54 | | - */ |
55 | | - function getUpgradeProposal(string calldata portId, string calldata channelId) |
56 | | - external |
57 | | - view |
58 | | - returns (UpgradeProposal memory); |
59 | | - |
60 | | - /** |
61 | | - * @dev Propose an upgrade for the given port, channel, and sequence |
62 | | - * @notice This function is only callable by an authorized upgrader |
63 | | - * The upgrader must call this function before calling `channelUpgradeInit` or `channelUpgradeTry` of the IBC handler |
64 | | - */ |
65 | | - function proposeUpgrade( |
66 | | - string calldata portId, |
67 | | - string calldata channelId, |
68 | | - UpgradeFields.Data calldata upgradeFields, |
69 | | - Timeout.Data calldata timeout |
70 | | - ) external; |
71 | | - |
72 | | - /** |
73 | | - * @dev Removes the proposed upgrade for the given port and channel |
74 | | - * @notice This function is only callable by an authorized upgrader |
75 | | - * @param portId Port identifier |
76 | | - * @param channelId Channel identifier |
77 | | - */ |
78 | | - function removeUpgradeProposal(string calldata portId, string calldata channelId) external; |
79 | | - |
80 | | - /** |
81 | | - * @dev Allow the upgrade to transition to the flush complete state |
82 | | - * @notice This function is only callable by an authorized upgrader |
83 | | - * WARNING: Before calling this function, the upgrader must ensure that all inflight packets have been received on the receiving chain, |
84 | | - * and all acknowledgements written have been acknowledged on the sending chain |
85 | | - */ |
86 | | - function allowTransitionToFlushComplete(string calldata portId, string calldata channelId, uint64 upgradeSequence) |
87 | | - external; |
88 | | -} |
| 4 | +import {Channel, UpgradeFields, Timeout} from "../../proto/Channel.sol"; |
| 5 | +import {IIBCHandler} from "../../core/25-handler/IIBCHandler.sol"; |
| 6 | +import {IIBCModuleUpgrade} from "../../core/26-router/IIBCModuleUpgrade.sol"; |
| 7 | +import {AppBase} from "./IBCAppBase.sol"; |
| 8 | +import {IIBCChannelUpgradableModule, IIBCChannelUpgradableModuleErrors} from "./IIBCChannelUpgradableModule.sol"; |
89 | 9 |
|
90 | 10 | abstract contract IBCChannelUpgradableModuleBase is |
91 | 11 | AppBase, |
@@ -312,10 +232,8 @@ abstract contract IBCChannelUpgradableModuleBase is |
312 | 232 | * @dev See {IERC165-supportsInterface} |
313 | 233 | */ |
314 | 234 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { |
315 | | - return |
316 | | - super.supportsInterface(interfaceId) || |
317 | | - interfaceId == type(IIBCModuleUpgrade).interfaceId || |
318 | | - interfaceId == type(IIBCChannelUpgradableModule).interfaceId; |
| 235 | + return super.supportsInterface(interfaceId) || interfaceId == type(IIBCModuleUpgrade).interfaceId |
| 236 | + || interfaceId == type(IIBCChannelUpgradableModule).interfaceId; |
319 | 237 | } |
320 | 238 |
|
321 | 239 | // ------------------- Internal Functions ------------------- // |
|
0 commit comments