Skip to content

Commit

Permalink
imp: replace cosmos with ibc in storage namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk committed Dec 23, 2024
1 parent 47c20e7 commit 75903fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions contracts/ICS20Transfer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/ICS26Router.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ 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;
address icsCore;
}

/// @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)) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/ICSCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ 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;
mapping(string clientType => uint32) nextClientSeq;
}

/// @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)) {
Expand Down
2 changes: 1 addition & 1 deletion test/solidity-ibc/MigrationTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
Expand Down

0 comments on commit 75903fa

Please sign in to comment.