diff --git a/contracts/InterchainTokenFactory.sol b/contracts/InterchainTokenFactory.sol index 29cfc42b..ef936708 100644 --- a/contracts/InterchainTokenFactory.sol +++ b/contracts/InterchainTokenFactory.sol @@ -278,7 +278,7 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M // This ensures that the token manager has been deployed by this address, so it's safe to trust it. salt = canonicalInterchainTokenSalt(chainNameHash, originalTokenAddress); tokenId = interchainTokenService.interchainTokenId(TOKEN_FACTORY_DEPLOYER, salt); - token = IInterchainToken(interchainTokenService.getManagedTokenAddress(tokenId)); + token = IInterchainToken(interchainTokenService.registeredTokenAddress(tokenId)); // The 3 lines below will revert if the token does not exist. string memory tokenName = token.name(); diff --git a/contracts/InterchainTokenService.sol b/contracts/InterchainTokenService.sol index 67b44f39..7289848b 100644 --- a/contracts/InterchainTokenService.sol +++ b/contracts/InterchainTokenService.sol @@ -198,7 +198,7 @@ contract InterchainTokenService is * @notice Returns the instance of ITokenManager from a specific tokenId. * @dev This function checks if a token manager contract exists at the address for the specified tokenId. * If no token manager is deployed for the tokenId, the function will revert with `TokenManagerDoesNotExist`. - * @param tokenId The tokenId. + * @param tokenId The tokenId of the deployed token manager. * @return tokenManager_ The instance of ITokenManager associated with the specified tokenId. */ function deployedTokenManager(bytes32 tokenId) public view returns (ITokenManager tokenManager_) { @@ -209,10 +209,12 @@ contract InterchainTokenService is /** * @notice Returns the address of the token that an existing tokenManager points to. - * @param tokenId The tokenId. + * @dev This function requires that a token manager is already deployed for the specified tokenId. + * It will call `deployedTokenManager` to get the token manager and return the address of the associated token. + * @param tokenId The tokenId of the registered token. * @return tokenAddress The address of the token. */ - function getManagedTokenAddress(bytes32 tokenId) public view returns (address tokenAddress) { + function registeredTokenAddress(bytes32 tokenId) public view returns (address tokenAddress) { tokenAddress = ITokenManager(deployedTokenManager(tokenId)).tokenAddress(); } @@ -1089,7 +1091,7 @@ contract InterchainTokenService is revert InvalidExpressMessageType(messageType); } - return (getManagedTokenAddress(tokenId), amount); + return (registeredTokenAddress(tokenId), amount); } function _getExpressExecutorAndEmitEvent( diff --git a/contracts/interfaces/IInterchainTokenService.sol b/contracts/interfaces/IInterchainTokenService.sol index b897c1a4..54dadff1 100644 --- a/contracts/interfaces/IInterchainTokenService.sol +++ b/contracts/interfaces/IInterchainTokenService.sol @@ -138,17 +138,17 @@ interface IInterchainTokenService is /** * @notice Returns the instance of ITokenManager from a specific tokenId. - * @param tokenId The tokenId. + * @param tokenId The tokenId of the deployed token manager. * @return tokenManager_ The instance of ITokenManager associated with the specified tokenId. */ function deployedTokenManager(bytes32 tokenId) external view returns (ITokenManager tokenManager_); /** * @notice Returns the address of the token that an existing tokenManager points to. - * @param tokenId The tokenId of the token manager. + * @param tokenId The tokenId of the registered token. * @return tokenAddress The address of the token. */ - function getManagedTokenAddress(bytes32 tokenId) external view returns (address tokenAddress); + function registeredTokenAddress(bytes32 tokenId) external view returns (address tokenAddress); /** * @notice Returns the address of the interchain token associated with the given tokenId. diff --git a/docs/index.md b/docs/index.md index 58e35fcb..e44214fb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -548,10 +548,10 @@ _The TokenManager needs to exist already._ | --------------------- | ------- | ------------------------------------------- | | tokenManagerAddress\_ | address | The deployment address of the TokenManager. | -### getManagedTokenAddress +### registeredTokenAddress ```solidity -function getManagedTokenAddress(bytes32 tokenId) public view returns (address tokenAddress) +function registeredTokenAddress(bytes32 tokenId) public view returns (address tokenAddress) ``` Returns the address of the token that an existing tokenManager points to. @@ -3034,10 +3034,10 @@ Returns the address of the valid token manager associated with the given tokenId | --------------------- | ------- | --------------------------------------- | | tokenManagerAddress\_ | address | The address of the valid token manager. | -### getManagedTokenAddress +### registeredTokenAddress ```solidity -function getManagedTokenAddress(bytes32 tokenId) external view returns (address tokenAddress) +function registeredTokenAddress(bytes32 tokenId) external view returns (address tokenAddress) ``` Returns the address of the token that an existing tokenManager points to. diff --git a/test/InterchainTokenService.js b/test/InterchainTokenService.js index 3f38f23f..dfdb5556 100644 --- a/test/InterchainTokenService.js +++ b/test/InterchainTokenService.js @@ -870,7 +870,7 @@ describe('Interchain Token Service', () => { expect(await tokenManager.isFlowLimiter(wallet.address)).to.be.true; expect(await tokenManager.isFlowLimiter(service.address)).to.be.true; - const tokenAddress = await service.getManagedTokenAddress(tokenId); + const tokenAddress = await service.registeredTokenAddress(tokenId); expect(tokenAddress).to.eq(token.address); tokenManagerProxy = await getContractAt('TokenManagerProxy', tokenManagerAddress, wallet); @@ -932,7 +932,7 @@ describe('Interchain Token Service', () => { expect(await tokenManager.isFlowLimiter(wallet.address)).to.be.true; expect(await tokenManager.isFlowLimiter(service.address)).to.be.true; - const tokenAddress = await service.getManagedTokenAddress(tokenId); + const tokenAddress = await service.registeredTokenAddress(tokenId); expect(tokenAddress).to.eq(token.address); const tokenManagerProxy = await getContractAt('TokenManagerProxy', tokenManagerAddress, wallet); @@ -969,7 +969,7 @@ describe('Interchain Token Service', () => { expect(await tokenManager.isFlowLimiter(wallet.address)).to.be.true; expect(await tokenManager.isFlowLimiter(service.address)).to.be.true; - const tokenAddress = await service.getManagedTokenAddress(tokenId); + const tokenAddress = await service.registeredTokenAddress(tokenId); expect(tokenAddress).to.eq(token.address); const tokenManagerProxy = await getContractAt('TokenManagerProxy', tokenManagerAddress, wallet); @@ -1006,7 +1006,7 @@ describe('Interchain Token Service', () => { expect(await tokenManager.isFlowLimiter(wallet.address)).to.be.true; expect(await tokenManager.isFlowLimiter(service.address)).to.be.true; - const tokenAddress = await service.getManagedTokenAddress(tokenId); + const tokenAddress = await service.registeredTokenAddress(tokenId); expect(tokenAddress).to.eq(token.address); const tokenManagerProxy = await getContractAt('TokenManagerProxy', tokenManagerAddress, wallet);