diff --git a/contracts/TokenHandler.sol b/contracts/TokenHandler.sol index 7b78a4cf..95a82c47 100644 --- a/contracts/TokenHandler.sol +++ b/contracts/TokenHandler.sol @@ -12,6 +12,7 @@ import { ITokenManagerType } from './interfaces/ITokenManagerType.sol'; import { ITokenManager } from './interfaces/ITokenManager.sol'; import { ITokenManagerProxy } from './interfaces/ITokenManagerProxy.sol'; import { IERC20MintableBurnable } from './interfaces/IERC20MintableBurnable.sol'; +import { IERC20BurnableFrom } from './interfaces/IERC20BurnableFrom.sol'; import { IERC20Named } from './interfaces/IERC20Named.sol'; /** @@ -98,15 +99,12 @@ contract TokenHandler is ITokenHandler, ITokenManagerType, ReentrancyGuard, Crea if (tokenOnly && msg.sender != tokenAddress) revert NotToken(msg.sender, tokenAddress); - /// @dev Track the flow amount being sent out as a message - ITokenManager(tokenManager).addFlowOut(amount); - if (tokenManagerType == uint256(TokenManagerType.NATIVE_INTERCHAIN_TOKEN)) { _takeInterchainToken(tokenAddress, from, amount); } else if (tokenManagerType == uint256(TokenManagerType.MINT_BURN)) { _burnToken(tokenManager, tokenAddress, from, amount); } else if (tokenManagerType == uint256(TokenManagerType.MINT_BURN_FROM)) { - _burnTokenFrom(tokenManager, tokenAddress, from, amount); + _burnTokenFrom(tokenAddress, from, amount); } else if (tokenManagerType == uint256(TokenManagerType.LOCK_UNLOCK)) { _transferTokenFrom(tokenAddress, from, tokenManager, amount); } else if (tokenManagerType == uint256(TokenManagerType.LOCK_UNLOCK_FEE)) { @@ -219,8 +217,8 @@ contract TokenHandler is ITokenHandler, ITokenManagerType, ReentrancyGuard, Crea ITokenManager(tokenManager).burnToken(tokenAddress, from, amount); } - function _burnTokenFrom(address tokenManager, address tokenAddress, address from, uint256 amount) internal { - ITokenManager(tokenManager).burnTokenFrom(tokenAddress, from, amount); + function _burnTokenFrom(address tokenAddress, address from, uint256 amount) internal { + IERC20(tokenAddress).safeCall(abi.encodeWithSelector(IERC20BurnableFrom.burnFrom.selector, from, amount)); } function _approveGateway(address tokenAddress, uint256 amount) internal { diff --git a/contracts/interfaces/ITokenManager.sol b/contracts/interfaces/ITokenManager.sol index 9c505201..50c582a9 100644 --- a/contracts/interfaces/ITokenManager.sol +++ b/contracts/interfaces/ITokenManager.sol @@ -92,13 +92,4 @@ interface ITokenManager is IBaseTokenManager, IOperator, IFlowLimit, IImplementa * @param amount The amount to burn. */ function burnToken(address tokenAddress_, address from, uint256 amount) external; - - /** - * @notice External function to allow the service to burn tokens through the tokenManager - * @dev This function should revert if called by anyone but the service. - * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager. - * @param from The address to burn the token from. - * @param amount The amount to burn. - */ - function burnTokenFrom(address tokenAddress_, address from, uint256 amount) external; } diff --git a/contracts/token-manager/TokenManager.sol b/contracts/token-manager/TokenManager.sol index 93f4fc20..e6d30174 100644 --- a/contracts/token-manager/TokenManager.sol +++ b/contracts/token-manager/TokenManager.sol @@ -11,7 +11,6 @@ import { Multicall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/uti import { ITokenManager } from '../interfaces/ITokenManager.sol'; import { IERC20MintableBurnable } from '../interfaces/IERC20MintableBurnable.sol'; -import { IERC20BurnableFrom } from '../interfaces/IERC20BurnableFrom.sol'; import { Operator } from '../utils/Operator.sol'; import { FlowLimit } from '../utils/FlowLimit.sol'; @@ -214,15 +213,4 @@ contract TokenManager is ITokenManager, Operator, FlowLimit, Implementation, Mul function burnToken(address tokenAddress_, address from, uint256 amount) external onlyService { IERC20(tokenAddress_).safeCall(abi.encodeWithSelector(IERC20MintableBurnable.burn.selector, from, amount)); } - - /** - * @notice External function to allow the service to burn tokens through the tokenManager - * @dev This function should revert if called by anyone but the service. - * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager. - * @param from The address to burn the token from. - * @param amount The amount to burn. - */ - function burnTokenFrom(address tokenAddress_, address from, uint256 amount) external onlyService { - IERC20(tokenAddress_).safeCall(abi.encodeWithSelector(IERC20BurnableFrom.burnFrom.selector, from, amount)); - } }