From 75903faf8ec4c77ce30d07e73458d75e1bb6931e Mon Sep 17 00:00:00 2001 From: srdtrk Date: Mon, 23 Dec 2024 16:53:42 +0800 Subject: [PATCH] imp: replace cosmos with ibc in storage namespace --- contracts/ICS20Transfer.sol | 6 +++--- contracts/ICS26Router.sol | 6 +++--- contracts/ICSCore.sol | 6 +++--- test/solidity-ibc/MigrationTest.t.sol | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts/ICS20Transfer.sol b/contracts/ICS20Transfer.sol index 9fa80e8..f6f4e2f 100644 --- a/contracts/ICS20Transfer.sol +++ b/contracts/ICS20Transfer.sol @@ -38,16 +38,16 @@ contract ICS20Transfer is /// @dev risk of storage collisions when using with upgradeable contracts. /// @param escrow The escrow contract /// @param ibcDenomContracts Mapping of non-native denoms to their respective IBCERC20 contracts - /// @custom:storage-location erc7201:cosmos.storage.ICS20Transfer + /// @custom:storage-location erc7201:ibc.storage.ICS20Transfer struct ICS20TransferStorage { IEscrow escrow; mapping(string => IBCERC20) ibcDenomContracts; } /// @notice ERC-7201 slot for the ICS20Transfer storage - /// @dev keccak256(abi.encode(uint256(keccak256("cosmos.storage.ICS20Transfer")) - 1)) & ~bytes32(uint256(0xff)) + /// @dev keccak256(abi.encode(uint256(keccak256("ibc.storage.ICS20Transfer")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ICS20TRANSFER_STORAGE_SLOT = - 0x3976c57dbbc8c99cc1b6dfcbe9e8eaca34d25dd5bd61ff189e8ec925f137f300; + 0x823f7a8ea9ae6df0eb03ec5e1682d7a2839417ad8a91774118e6acf2e8d2f800; /// @dev This contract is meant to be deployed by a proxy, so the constructor is not used constructor() Ownable(address(0xdead)) { diff --git a/contracts/ICS26Router.sol b/contracts/ICS26Router.sol index 03a91d5..32f64e0 100644 --- a/contracts/ICS26Router.sol +++ b/contracts/ICS26Router.sol @@ -36,7 +36,7 @@ contract ICS26Router is /// @param apps The mapping of port identifiers to IBC application contracts /// @param ibcStore The IBC store contract /// @param icsCore The ICSCore contract - /// @custom:storage-location erc7201:cosmos.storage.ICS26Router + /// @custom:storage-location erc7201:ibc.storage.ICS26Router struct ICS26RouterStorage { mapping(string => IIBCApp) apps; IIBCStore ibcStore; @@ -44,9 +44,9 @@ contract ICS26Router is } /// @notice ERC-7201 slot for the ICS26Router storage - /// @dev keccak256(abi.encode(uint256(keccak256("cosmos.storage.ICS26Router")) - 1)) & ~bytes32(uint256(0xff)) + /// @dev keccak256(abi.encode(uint256(keccak256("ibc.storage.ICS26Router")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ICS26ROUTER_STORAGE_SLOT = - 0xfe3fdec88e4c48b34bf06b700cefd11fbe5d40f4bdc480a03eaef10cb7f3f800; + 0xc5779f3c2c21083eefa6d04f6a698bc0d8c10db124ad5e0df6ef394b6d7bf600; /// @dev This contract is meant to be deployed by a proxy, so the constructor is not used constructor() Ownable(address(0xdead)) { diff --git a/contracts/ICSCore.sol b/contracts/ICSCore.sol index 0e6d2d0..664801f 100644 --- a/contracts/ICSCore.sol +++ b/contracts/ICSCore.sol @@ -17,7 +17,7 @@ contract ICSCore is IICS02Client, IICS04Channel, IICS02ClientErrors, Initializab /// @param channels Mapping of client identifiers to channels /// @param clients Mapping of client identifiers to light client contracts /// @param nextClientSeq Mapping of client types to the next client sequence - /// @custom:storage-location erc7201:cosmos.storage.ICSCore + /// @custom:storage-location erc7201:ibc.storage.ICSCore struct ICSCoreStorage { mapping(string clientId => Channel) channels; mapping(string clientId => ILightClient) clients; @@ -25,8 +25,8 @@ contract ICSCore is IICS02Client, IICS04Channel, IICS02ClientErrors, Initializab } /// @notice ERC-7201 slot for the ICSCore storage - /// @dev keccak256(abi.encode(uint256(keccak256("cosmos.storage.ICSCore")) - 1)) & ~bytes32(uint256(0xff)) - bytes32 private constant ICSCORE_STORAGE_SLOT = 0xd77327ff2954bddd826a8a04ad1c6d0923c50f3ddca6ff0b4d10223afaa23000; + /// @dev keccak256(abi.encode(uint256(keccak256("ibc.storage.ICSCore")) - 1)) & ~bytes32(uint256(0xff)) + bytes32 private constant ICSCORE_STORAGE_SLOT = 0x96c0fa34415d0022ef5b75a694f23f508dd3f8a3506b45247b4c4b205af19a00; /// @dev This contract is meant to be deployed by a proxy, so the constructor is not used constructor() Ownable(address(0xdead)) { diff --git a/test/solidity-ibc/MigrationTest.t.sol b/test/solidity-ibc/MigrationTest.t.sol index 1a6430c..8551f4b 100644 --- a/test/solidity-ibc/MigrationTest.t.sol +++ b/test/solidity-ibc/MigrationTest.t.sol @@ -88,7 +88,7 @@ contract MigrationTest is Test { ); bytes32 slot = - keccak256(abi.encode(uint256(keccak256("cosmos.storage.ICS20Transfer")) - 1)) & ~bytes32(uint256(0xff)); + keccak256(abi.encode(uint256(keccak256("ibc.storage.ICSCore")) - 1)) & ~bytes32(uint256(0xff)); console.log("lol", Strings.toHexString(uint256(slot))); }