diff --git a/contracts/registry/ChainNft.sol b/contracts/registry/ChainNft.sol index a4f034ab..e2de9c0f 100644 --- a/contracts/registry/ChainNft.sol +++ b/contracts/registry/ChainNft.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.20; import {ERC721, ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; +import {ChainId, ChainIdLib} from "../type/ChainId.sol"; import {ITransferInterceptor} from "./ITransferInterceptor.sol"; contract ChainNft is ERC721Enumerable { @@ -53,7 +54,7 @@ contract ChainNft is ERC721Enumerable { // NFT contract is deployed by the registry _registry = registry; - _chainIdDigits = _calculateChainIdDigits(block.chainid); + _chainIdDigits = _calculateChainIdDigits(ChainIdLib.toChainId(block.chainid)); _chainIdMultiplier = 10 ** _chainIdDigits; // the first object registered through normal registration starts with id 4 @@ -200,12 +201,12 @@ contract ChainNft is ERC721Enumerable { * (42 * 10 ** 10 + 9876543210) * 100 + 10 * (index * 10 ** digits + chainid) * 100 + digits (1 < digits < 100) */ - function calculateTokenId(uint256 idIndex, uint256 chainId) public view returns (uint256 id) { - if(chainId == block.chainid) { - return 100 * (idIndex * _chainIdMultiplier + chainId) + _chainIdDigits; + function calculateTokenId(uint256 idIndex, ChainId chainId) public view returns (uint256 id) { + if(chainId.toInt() == block.chainid) { + return 100 * (idIndex * _chainIdMultiplier + chainId.toInt()) + _chainIdDigits; } else { uint256 chainIdDigits = _calculateChainIdDigits(chainId); - return 100 * (idIndex * (10 ** chainIdDigits) + chainId) + chainIdDigits; + return 100 * (idIndex * (10 ** chainIdDigits) + chainId.toInt()) + chainIdDigits; } } @@ -224,8 +225,8 @@ contract ChainNft is ERC721Enumerable { _idNext++; } - function _calculateChainIdDigits(uint256 chainId) private pure returns (uint256) { - uint256 num = chainId; + function _calculateChainIdDigits(ChainId chainId) private pure returns (uint256) { + uint256 num = chainId.toInt(); uint256 digits = 0; while (num != 0) { digits++; diff --git a/contracts/registry/IRegistry.sol b/contracts/registry/IRegistry.sol index 66726a56..b0592129 100644 --- a/contracts/registry/IRegistry.sol +++ b/contracts/registry/IRegistry.sol @@ -5,6 +5,7 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {IRelease} from "./IRelease.sol"; +import {ChainId} from "../type/ChainId.sol"; import {NftId} from "../type/NftId.sol"; import {ObjectType} from "../type/ObjectType.sol"; import {VersionPart} from "../type/Version.sol"; @@ -21,7 +22,7 @@ interface IRegistry is event LogRegistryObjectRegistered(NftId indexed nftId, NftId indexed parentNftId, ObjectType indexed objectType, bool isInterceptor, address objectAddress, address initialOwner); event LogRegistryServiceRegistered(NftId indexed nftId, VersionPart indexed majorVersion, ObjectType indexed domain); - event LogRegistryChainRegistryRegistered(NftId indexed nftId, uint256 indexed chainId, address indexed chainRegistryAddress); + event LogRegistryChainRegistryRegistered(NftId indexed nftId, ChainId indexed chainId, address indexed chainRegistryAddress); // initialize error ErrorRegistryCallerNotDeployer(); @@ -30,11 +31,11 @@ interface IRegistry is error ErrorRegistryObjectTypeNotSupported(ObjectType objectType); // registerRegistry() - error ErrorRegistryNotOnMainnet(uint256 chainId); + error ErrorRegistryNotOnMainnet(ChainId chainId); error ErrorRegistryChainRegistryChainIdZero(NftId nftId); - error ErrorRegistryChainRegistryAddressZero(NftId nftId, uint256 chainId); - error ErrorRegistryChainRegistryNftIdInvalid(NftId nftId, uint256 chainId); - error ErrorRegistryChainRegistryAlreadyRegistered(NftId nftId, uint256 chainId); + error ErrorRegistryChainRegistryAddressZero(NftId nftId, ChainId chainId); + error ErrorRegistryChainRegistryNftIdInvalid(NftId nftId, ChainId chainId); + error ErrorRegistryChainRegistryAlreadyRegistered(NftId nftId, ChainId chainId); // registerService() error ErrorRegistryServiceAddressZero(); @@ -71,7 +72,7 @@ interface IRegistry is /// Only one chain registry may be registered per chain function registerRegistry( NftId nftId, - uint256 chainId, + ChainId chainId, address chainRegistryAddress ) external; @@ -107,10 +108,10 @@ interface IRegistry is function chainIds() external view returns (uint256); /// @dev Returns the chain id at the specified index. - function getChainId(uint256 idx) external view returns (uint256); + function getChainId(uint256 idx) external view returns (ChainId); /// @dev Returns the NFT ID of the registry for the specified chain. - function getRegistryNftId(uint256 chainId) external returns (NftId nftId); + function getRegistryNftId(ChainId chainId) external returns (NftId nftId); function getObjectCount() external view returns (uint256); diff --git a/contracts/registry/Registry.sol b/contracts/registry/Registry.sol index f6d72d3b..5cb8ca7f 100644 --- a/contracts/registry/Registry.sol +++ b/contracts/registry/Registry.sol @@ -9,6 +9,7 @@ import {NftId, NftIdLib} from "../type/NftId.sol"; import {VersionPart, VersionPartLib} from "../type/Version.sol"; import {ObjectType, ObjectTypeLib, PROTOCOL, REGISTRY, SERVICE, INSTANCE, STAKE, STAKING, PRODUCT, DISTRIBUTION, DISTRIBUTOR, ORACLE, POOL, POLICY, BUNDLE} from "../type/ObjectType.sol"; +import {ChainId, ChainIdLib} from "../type/ChainId.sol"; import {ChainNft} from "./ChainNft.sol"; import {IRegistry} from "./IRegistry.sol"; import {IRelease} from "./IRelease.sol"; @@ -63,8 +64,8 @@ contract Registry is string public constant EMPTY_URI = ""; /// @dev keep track of different registries on different chains - mapping(uint256 chainId => NftId registryNftId) private _registryNftIdByChainId; - uint256[] private _chainId; + mapping(ChainId chainId => NftId registryNftId) private _registryNftIdByChainId; + ChainId[] private _chainId; /// @dev keep track of object info and address reverse lookup mapping(NftId nftId => ObjectInfo info) private _info; @@ -143,7 +144,7 @@ contract Registry is /// @inheritdoc IRegistry function registerRegistry( NftId nftId, - uint256 chainId, + ChainId chainId, address registryAddress ) external @@ -151,11 +152,11 @@ contract Registry is { // registration of chain registries only allowed on mainnet if (block.chainid != 1) { - revert ErrorRegistryNotOnMainnet(block.chainid); + revert ErrorRegistryNotOnMainnet(ChainIdLib.toChainId(block.chainid)); } // registry chain id is not zero - if(chainId == 0) { + if(chainId.eqz()) { revert ErrorRegistryChainRegistryChainIdZero(nftId); } @@ -320,11 +321,11 @@ contract Registry is return _chainId.length; } - function getChainId(uint256 idx) public view returns (uint256) { + function getChainId(uint256 idx) public view returns (ChainId) { return _chainId[idx]; } - function getRegistryNftId(uint256 chainId) public view returns (NftId nftId) { + function getRegistryNftId(ChainId chainId) public view returns (NftId nftId) { return _registryNftIdByChainId[chainId]; } @@ -579,7 +580,7 @@ contract Registry is // register global registry _registerRegistryForNft( - 1, // mainnet chain id + ChainIdLib.toChainId(1), // mainnet chain id ObjectInfo({ nftId: GLOBAL_REGISTRY_NFT_ID, parentNftId: PROTOCOL_NFT_ID, @@ -598,7 +599,7 @@ contract Registry is CHAIN_NFT.calculateTokenId(REGISTRY_TOKEN_SEQUENCE_ID)); _registerRegistryForNft( - block.chainid, + ChainIdLib.toChainId(block.chainid), ObjectInfo({ nftId: registryNftId, parentNftId: GLOBAL_REGISTRY_NFT_ID, @@ -613,7 +614,7 @@ contract Registry is /// @dev staking registration function _registerRegistryForNft( - uint256 chainId, + ChainId chainId, ObjectInfo memory info, bool updateAddressLookup ) diff --git a/contracts/staking/StakingService.sol b/contracts/staking/StakingService.sol index 40aa2f39..6ebb44be 100644 --- a/contracts/staking/StakingService.sol +++ b/contracts/staking/StakingService.sol @@ -52,7 +52,6 @@ contract StakingService is virtual restricted() { - uint256 chainId = block.chainid; _getStakingServiceStorage()._staking.registerTarget( targetNftId, INSTANCE(), diff --git a/scripts/libs/registry.ts b/scripts/libs/registry.ts index f2b32c7a..ef7838f0 100644 --- a/scripts/libs/registry.ts +++ b/scripts/libs/registry.ts @@ -153,6 +153,7 @@ export async function deployAndInitializeRegistry(owner: Signer, libraries: Libr [registryAdminAddress, globalRegistry], { libraries: { + ChainIdLib: libraries.chainIdLibAddress, NftIdLib: libraries.nftIdLibAddress, ObjectTypeLib: libraries.objectTypeLibAddress, VersionPartLib: libraries.versionPartLibAddress, diff --git a/test/base/GifTestHelper.sol b/test/base/GifTestHelper.sol new file mode 100644 index 00000000..64472983 --- /dev/null +++ b/test/base/GifTestHelper.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.20; + +import {ChainId} from "../../contracts/type/ChainId.sol"; +import {StdAssertions} from "forge-std/StdAssertions.sol"; + +contract GifTestHelper is StdAssertions { + + function assertEqChainId(ChainId chainId1, ChainId chainId2) public pure { + assertEq(chainId1.toInt(), chainId2.toInt(), "ChainId not equal"); + } + + function assertEqChainId(ChainId chainId1, ChainId chainId2, string memory err) public pure { + assertEq(chainId1.toInt(), chainId2.toInt(), err); + } + +} \ No newline at end of file diff --git a/test/registry/RegistryTestBase.sol b/test/registry/RegistryTestBase.sol index ab263c56..b71cba8d 100644 --- a/test/registry/RegistryTestBase.sol +++ b/test/registry/RegistryTestBase.sol @@ -17,6 +17,7 @@ import {ObjectType, ObjectTypeLib, PROTOCOL, REGISTRY, STAKING, SERVICE, INSTANC import {IAccessAdmin} from "../../contracts/authorization/IAccessAdmin.sol"; +import {ChainId, ChainIdLib} from "../../contracts/type/ChainId.sol"; import {ChainNft} from "../../contracts/registry/ChainNft.sol"; import {IRegistry} from "../../contracts/registry/IRegistry.sol"; import {Registry} from "../../contracts/registry/Registry.sol"; @@ -34,10 +35,11 @@ import {RegistryServiceMock} from "../mock/RegistryServiceMock.sol"; import {ServiceAuthorizationMockWithRegistryService} from "../mock/ServiceAuthorizationMock.sol"; import {GifDeployer} from "../base/GifDeployer.sol"; +import {GifTestHelper} from "../base/GifTestHelper.sol"; -contract RegistryTestBase is GifDeployer, FoundryRandom { +contract RegistryTestBase is GifDeployer, FoundryRandom, GifTestHelper { // keep identical to ChainNft events event LogTokenInterceptorAddress(uint256 tokenId, address interceptor); @@ -539,7 +541,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertTrue(registryAddress != address(0), "Test error: _afterRegistryRegistration() is called with 0 registry address"); //assertNotEq(registry, globalRegistryInfo.objectAddress, "Test error: _afterRegistryRegistration() called with globalRegistry address"); // chain registry can have global address - assertEq(nftId.toInt(), chainNft.calculateTokenId(registry.REGISTRY_TOKEN_SEQUENCE_ID(), chainId), "Test error: _registryNftIdByChainId[chainId] inconsictent with chainNft.calculateTokenId[REGISTRY_TOKEN_SEQUENCE_ID, chainId]"); + assertEq(nftId.toInt(), chainNft.calculateTokenId(registry.REGISTRY_TOKEN_SEQUENCE_ID(), ChainIdLib.toChainId(chainId)), "Test error: _registryNftIdByChainId[chainId] inconsictent with chainNft.calculateTokenId[REGISTRY_TOKEN_SEQUENCE_ID, chainId]"); assertTrue(_registryNftIdByChainId[chainId].eqz(), "Test error: _registryNftIdByChainId[chainId] already set"); assertFalse(EnumerableSet.contains(_chainIds, chainId), "Test error: _chainIds[] already contains chainId"); @@ -704,10 +706,10 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.chainIds(), EnumerableSet.length(_chainIds), "getChainIds() returned unexpected value"); for(uint i = 0; i < EnumerableSet.length(_chainIds); i++) { - uint64 chainId = uint64(EnumerableSet.at(_chainIds, i)); - assertEq(registry.getChainId(i), chainId, "getChainId(i) returned unexpected value"); + ChainId chainId = ChainIdLib.toChainId(uint64(EnumerableSet.at(_chainIds, i))); + assertEqChainId(registry.getChainId(i), chainId, "getChainId(i) returned unexpected value"); - NftId nftId = _registryNftIdByChainId[chainId]; + NftId nftId = _registryNftIdByChainId[chainId.toInt()]; assertEq(registry.getRegistryNftId(chainId).toInt(), nftId.toInt(), "getRegistryNftId(chainId) returned unexpected value"); // redundant calls? @@ -784,7 +786,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.isRegisteredService(protocolInfo.objectAddress), false, "isRegisteredService(address) returned unexpected value #1"); assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , address(0), "getServiceAddress(domain, version) returned unexpected value #1"); - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #1"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #1"); } else if(nftId == globalRegistryNftId) { @@ -847,7 +849,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { } } - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), globalRegistryNftId.toInt(), "getRegistryNftId(chainId) returned unexpected value #2"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), globalRegistryNftId.toInt(), "getRegistryNftId(chainId) returned unexpected value #2"); } else if(nftId == registryNftId) {// not mainnet, registry have address lookup set @@ -866,7 +868,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.isRegisteredService(registryInfo.objectAddress), false, "isRegisteredService(address) returned unexpected value #3"); assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , address(0), "getServiceAddress(domain, version) returned unexpected value #3"); - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), registryNftId.toInt(), "getRegistryNftId(chainId) returned unexpected value #3"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), registryNftId.toInt(), "getRegistryNftId(chainId) returned unexpected value #3"); } else if(expectedInfo.objectType == REGISTRY()) {// mainnet, chain registry @@ -917,7 +919,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , address(0), "getServiceAddress(domain, version) returned unexpected value #4.4"); } - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), expectedInfo.nftId.toInt(), "getRegistryNftId(chainId) returned unexpected value #4"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), expectedInfo.nftId.toInt(), "getRegistryNftId(chainId) returned unexpected value #4"); } else if(expectedInfo.objectType == SERVICE()) { @@ -938,7 +940,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.isRegisteredService(expectedInfo.objectAddress), true, "isRegisteredService(address) returned unexpected value #5"); assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , expectedInfo.objectAddress, "getServiceAddress(domain, version) returned unexpected value #5"); - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #5"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #5"); } else if(expectedParentType == INSTANCE()) { @@ -973,7 +975,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.isRegisteredService(expectedInfo.objectAddress), false, "isRegisteredService(address) returned unexpected value #6"); assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , address(0), "getServiceAddress(domain, version) returned unexpected value #6"); - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #6"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #6"); } else if(expectedInfo.objectAddress > address(0)) {// the rest contracts @@ -991,7 +993,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.isRegisteredService(expectedInfo.objectAddress), false, "isRegisteredService(address) returned unexpected value #7"); assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , address(0), "getServiceAddress(domain, version) returned unexpected value #7"); - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #7"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #7"); } else { // the rest objects, some checks are redundant? @@ -1010,7 +1012,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { assertEq(registry.isRegisteredService(expectedInfo.objectAddress), false, "isRegisteredService(address) returned unexpected value #8"); assertEq(registry.getServiceAddress(expectedDomain, expectedVersion) , address(0), "getServiceAddress(domain, version) returned unexpected value #8"); - assertEq(registry.getRegistryNftId(expectedChainId).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #8"); + assertEq(registry.getRegistryNftId(ChainIdLib.toChainId(expectedChainId)).toInt(), 0, "getRegistryNftId(chainId) returned unexpected value #8"); } } @@ -1055,7 +1057,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { function _assert_registerRegistry( NftId nftId, - uint64 chainId, + ChainId chainId, address registryAddress, bool expectRevert, bytes memory revertMsg) internal @@ -1085,7 +1087,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { if(expectRevert == false) { - _afterRegistryRegistration(nftId, chainId, registryAddress); + _afterRegistryRegistration(nftId, uint64(chainId.toInt()), registryAddress); _checkRegistryGetters(); @@ -1098,7 +1100,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { } } - function _assert_registerRegistry_withChecks(NftId nftId, uint64 chainId, address registry) public + function _assert_registerRegistry_withChecks(NftId nftId, ChainId chainId, address registry) public { bool expectRevert; bytes memory expectedRevertMsg; @@ -1110,7 +1112,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { _assert_registerRegistry(nftId, chainId, registry, expectRevert, expectedRevertMsg); } - function _registerRegistryChecks(NftId nftId, uint64 chainId, address registryAddress) internal view returns (bool expectRevert, bytes memory expectedRevertMsg) + function _registerRegistryChecks(NftId nftId, ChainId chainId, address registryAddress) internal view returns (bool expectRevert, bytes memory expectedRevertMsg) { if(_sender != gifAdmin) {// auth check @@ -1121,7 +1123,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { //assertTrue(false, "_registerRegistryChecks() check 2 is reached"); expectedRevertMsg = abi.encodeWithSelector(IRegistry.ErrorRegistryNotOnMainnet.selector, block.chainid); expectRevert = true; - } else if(chainId == 0) { + } else if(chainId.eqz()) { //assertTrue(false, "_registerRegistryChecks() check 3 is reached"); expectedRevertMsg = abi.encodeWithSelector(IRegistry.ErrorRegistryChainRegistryChainIdZero.selector, nftId); expectRevert = true; @@ -1137,7 +1139,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { //assertTrue(false, "_registerRegistryChecks() check 6 is reached"); expectedRevertMsg = abi.encodeWithSelector(IRegistry.ErrorRegistryChainRegistryAlreadyRegistered.selector, nftId, chainId); expectRevert = true; - } else if(_registryNftIdByChainId[chainId].gtz()) { + } else if(_registryNftIdByChainId[chainId.toInt()].gtz()) { assertTrue(false, "_registerRegistryChecks check 7 is reached"); // MUST not get here } } @@ -1145,7 +1147,7 @@ contract RegistryTestBase is GifDeployer, FoundryRandom { function registerRegistry_testFunction( address sender, NftId nftId, - uint64 chainId, + ChainId chainId, address registry) public { _startPrank(sender); diff --git a/test/registry/RegistryTestBaseWithPreset.sol b/test/registry/RegistryTestBaseWithPreset.sol index 08dd50b4..f39f3f87 100644 --- a/test/registry/RegistryTestBaseWithPreset.sol +++ b/test/registry/RegistryTestBaseWithPreset.sol @@ -4,6 +4,7 @@ pragma solidity ^0.8.20; import { FoundryRandom } from "foundry-random/FoundryRandom.sol"; import {console} from "../../lib/forge-std/src/Test.sol"; +import {ChainId, ChainIdLib} from "../../contracts/type/ChainId.sol"; import {NftId, NftIdLib} from "../../contracts/type/NftId.sol"; import {Timestamp} from "../../contracts/type/Timestamp.sol"; import {ObjectType, PROTOCOL, REGISTRY, SERVICE, INSTANCE, PRODUCT, POOL, ORACLE, DISTRIBUTION, DISTRIBUTOR, BUNDLE, POLICY, STAKE, STAKING} from "../../contracts/type/ObjectType.sol"; @@ -21,7 +22,7 @@ contract RegistryTestBaseWithPreset is RegistryTestBase NftId _chainRegistryNftId; // use on mainnet only address _chainRegistryAddress; - uint64 _chainRegistryChainId; + ChainId _chainRegistryChainId; NftId _instanceNftId; NftId _productNftId; @@ -87,7 +88,7 @@ contract RegistryTestBaseWithPreset is RegistryTestBase { assert(block.chainid == 1); - _chainRegistryChainId = _getRandomNotRegisteredChainId(); + _chainRegistryChainId = ChainIdLib.toChainId(_getRandomNotRegisteredChainId()); NftId nftId = NftIdLib.toNftId( chainNft.calculateTokenId(registry.REGISTRY_TOKEN_SEQUENCE_ID(), _chainRegistryChainId) ); diff --git a/test/staking/StakingOwner.t.sol b/test/staking/StakingOwner.t.sol index 1c3d33d5..a10aa397 100644 --- a/test/staking/StakingOwner.t.sol +++ b/test/staking/StakingOwner.t.sol @@ -49,7 +49,7 @@ contract StakingOwnerTest is GifTest { function setUp() public override { super.setUp(); - stakingNftIdInt = chainNft.calculateTokenId(registry.STAKING_TOKEN_SEQUENCE_ID(), block.chainid); + stakingNftIdInt = chainNft.calculateTokenId(registry.STAKING_TOKEN_SEQUENCE_ID(), ChainIdLib.toChainId(block.chainid)); expectedStakingNftId = NftIdLib.toNftId(stakingNftIdInt); } @@ -59,7 +59,7 @@ contract StakingOwnerTest is GifTest { // solhint-disable console.log("staking seq", registry.STAKING_TOKEN_SEQUENCE_ID()); console.log("chain id", ChainIdLib.current().toInt()); - console.log("staking id (expected)", chainNft.calculateTokenId(registry.STAKING_TOKEN_SEQUENCE_ID(), block.chainid)); + console.log("staking id (expected)", chainNft.calculateTokenId(registry.STAKING_TOKEN_SEQUENCE_ID(), ChainIdLib.toChainId(block.chainid))); console.log("staking nft id (actual)", staking.getNftId().toInt()); // check staking owner