Skip to content

Commit

Permalink
refactor imports
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Nov 10, 2023
1 parent f6610c2 commit 6349526
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 25 deletions.
31 changes: 31 additions & 0 deletions contracts/interfaces/IBaseTokenManager.sol
Original file line number Diff line number Diff line change
@@ -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);
}
26 changes: 2 additions & 24 deletions contracts/interfaces/ITokenManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ 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';

/**
* @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();
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion contracts/token-manager/TokenManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down

0 comments on commit 6349526

Please sign in to comment.