From 6349526a544d593e4b2197b12b3d5152581ecb50 Mon Sep 17 00:00:00 2001 From: Milap Sheth Date: Fri, 10 Nov 2023 13:06:25 -0500 Subject: [PATCH] refactor imports --- contracts/interfaces/IBaseTokenManager.sol | 31 ++++++++++++++++++++++ contracts/interfaces/ITokenManager.sol | 26 ++---------------- contracts/token-manager/TokenManager.sol | 3 ++- 3 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 contracts/interfaces/IBaseTokenManager.sol diff --git a/contracts/interfaces/IBaseTokenManager.sol b/contracts/interfaces/IBaseTokenManager.sol new file mode 100644 index 00000000..5db77340 --- /dev/null +++ b/contracts/interfaces/IBaseTokenManager.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +/** + * @title IBaseTokenManager + * @notice This contract is defines the base token manager interface implemented by all token managers. + */ +interface IBaseTokenManager { + /** + * @notice A function that returns the token id. + */ + function interchainTokenId() external view returns (bytes32); + + /** + * @notice A function that should return the address of the token. + * Must be overridden in the inheriting contract. + * @return address address of the token. + */ + function tokenAddress() external view returns (address); + + /** + * @notice A function that should return the implementation type of the token manager. + */ + function implementationType() external pure returns (uint256); + + /** + * @notice A function that should return the token address from the init params. + */ + function getTokenAddressFromParams(bytes calldata params) external pure returns (address); +} diff --git a/contracts/interfaces/ITokenManager.sol b/contracts/interfaces/ITokenManager.sol index 347f7d6b..07c600a6 100644 --- a/contracts/interfaces/ITokenManager.sol +++ b/contracts/interfaces/ITokenManager.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; import { IImplementation } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IImplementation.sol'; -import { ITokenManagerType } from './ITokenManagerType.sol'; +import { IBaseTokenManager } from './IBaseTokenManager.sol'; import { IOperatable } from './IOperatable.sol'; import { IFlowLimit } from './IFlowLimit.sol'; @@ -12,7 +12,7 @@ import { IFlowLimit } from './IFlowLimit.sol'; * @title ITokenManager * @notice This contract is responsible for handling tokens before initiating a cross chain token transfer, or after receiving one. */ -interface ITokenManager is ITokenManagerType, IOperatable, IFlowLimit, IImplementation { +interface ITokenManager is IBaseTokenManager, IOperatable, IFlowLimit, IImplementation { error TokenLinkerZeroAddress(); error NotService(address caller); error TakeTokenFailed(); @@ -22,28 +22,6 @@ interface ITokenManager is ITokenManagerType, IOperatable, IFlowLimit, IImplemen error AlreadyFlowLimiter(address flowLimiter); error NotFlowLimiter(address flowLimiter); - /** - * @notice A function that returns the token id. - */ - function interchainTokenId() external view returns (bytes32); - - /** - * @notice A function that should return the address of the token. - * Must be overridden in the inheriting contract. - * @return address address of the token. - */ - function tokenAddress() external view returns (address); - - /** - * @notice A function that should return the implementation type of the token manager. - */ - function implementationType() external pure returns (uint256); - - /** - * @notice A function that should return the token address from the init params. - */ - function getTokenAddressFromParams(bytes calldata params) external pure returns (address); - /** * @notice Calls the service to initiate a cross-chain transfer after taking the appropriate amount of tokens from the user. * @param destinationChain the name of the chain to send tokens to. diff --git a/contracts/token-manager/TokenManager.sol b/contracts/token-manager/TokenManager.sol index fb10a153..442eb633 100644 --- a/contracts/token-manager/TokenManager.sol +++ b/contracts/token-manager/TokenManager.sol @@ -7,6 +7,7 @@ import { IImplementation } from '@axelar-network/axelar-gmp-sdk-solidity/contrac import { Implementation } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Implementation.sol'; import { ITokenManager } from '../interfaces/ITokenManager.sol'; +import { ITokenManagerType } from '../interfaces/ITokenManagerType.sol'; import { IInterchainTokenService } from '../interfaces/IInterchainTokenService.sol'; import { Operatable } from '../utils/Operatable.sol'; @@ -16,7 +17,7 @@ import { FlowLimit } from '../utils/FlowLimit.sol'; * @title The main functionality of TokenManagers. * @notice This contract is responsible for handling tokens before initiating a cross chain token transfer, or after receiving one. */ -abstract contract TokenManager is ITokenManager, Operatable, FlowLimit, Implementation { +abstract contract TokenManager is ITokenManager, ITokenManagerType, Operatable, FlowLimit, Implementation { using AddressBytes for bytes; IInterchainTokenService public immutable interchainTokenService;