diff --git a/contracts/interchain-token-service/InterchainTokenService.sol b/contracts/interchain-token-service/InterchainTokenService.sol index d005a47c..4ba539c6 100644 --- a/contracts/interchain-token-service/InterchainTokenService.sol +++ b/contracts/interchain-token-service/InterchainTokenService.sol @@ -2,7 +2,6 @@ pragma solidity ^0.8.0; -import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol'; import { IAxelarGasService } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGasService.sol'; import { AxelarExecutable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/executable/AxelarExecutable.sol'; import { SafeTokenTransferFrom } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/SafeTransfer.sol'; diff --git a/contracts/interchain-token/InterchainToken.sol b/contracts/interchain-token/InterchainToken.sol index edd81eb7..3d7c29f8 100644 --- a/contracts/interchain-token/InterchainToken.sol +++ b/contracts/interchain-token/InterchainToken.sol @@ -61,7 +61,7 @@ abstract contract InterchainToken is IInterchainToken, ERC20 { ) external payable { uint256 _allowance = allowance[sender][msg.sender]; - if (_allowance != type(uint256).max) { + if (_allowance != UINT256_MAX) { _approve(sender, msg.sender, _allowance - amount); } diff --git a/contracts/interfaces/IInterchainTokenService.sol b/contracts/interfaces/IInterchainTokenService.sol index 82201e79..a46bcfd2 100644 --- a/contracts/interfaces/IInterchainTokenService.sol +++ b/contracts/interfaces/IInterchainTokenService.sol @@ -2,11 +2,9 @@ pragma solidity ^0.8.0; -import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol'; import { IAxelarExecutable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarExecutable.sol'; import { IExpressCallHandler } from './IExpressCallHandler.sol'; -import { ITokenManagerDeployer } from './ITokenManagerDeployer.sol'; import { ITokenManagerType } from './ITokenManagerType.sol'; import { IPausable } from './IPausable.sol'; import { IMulticall } from './IMulticall.sol'; @@ -30,9 +28,9 @@ interface IInterchainTokenService is ITokenManagerType, IExpressCallHandler, IAx error AlreadyExecuted(bytes32 commandId); error InvalidExpressSelector(); - event TokenSent(bytes32 tokenId, string destinationChain, bytes destinationAddress, uint256 indexed amount); + event TokenSent(bytes32 indexed tokenId, string destinationChain, bytes destinationAddress, uint256 indexed amount); event TokenSentWithData( - bytes32 tokenId, + bytes32 indexed tokenId, string destinationChain, bytes destinationAddress, uint256 indexed amount, @@ -62,7 +60,7 @@ interface IInterchainTokenService is ITokenManagerType, IExpressCallHandler, IAx uint8 tokenDecimals, bytes distributor, bytes mintTo, - uint256 mintAmount, + uint256 indexed mintAmount, bytes operator, string destinationChain, uint256 indexed gasValue @@ -70,11 +68,11 @@ interface IInterchainTokenService is ITokenManagerType, IExpressCallHandler, IAx event TokenManagerDeployed(bytes32 indexed tokenId, TokenManagerType indexed tokenManagerType, bytes params); event StandardizedTokenDeployed( bytes32 indexed tokenId, - address distributor, + address indexed distributor, string name, string symbol, uint8 decimals, - uint256 mintAmount, + uint256 indexed mintAmount, address mintTo ); event CustomTokenIdClaimed(bytes32 indexed tokenId, address indexed deployer, bytes32 indexed salt); diff --git a/contracts/interfaces/IPausable.sol b/contracts/interfaces/IPausable.sol index f58eecf6..c5adbd7f 100644 --- a/contracts/interfaces/IPausable.sol +++ b/contracts/interfaces/IPausable.sol @@ -8,7 +8,7 @@ pragma solidity ^0.8.0; * if a pause condition is activated. */ interface IPausable { - event PausedSet(bool paused); + event PausedSet(bool indexed paused); error Paused(); diff --git a/contracts/remote-address-validator/RemoteAddressValidator.sol b/contracts/remote-address-validator/RemoteAddressValidator.sol index 75881d9e..89d7d40c 100644 --- a/contracts/remote-address-validator/RemoteAddressValidator.sol +++ b/contracts/remote-address-validator/RemoteAddressValidator.sol @@ -143,8 +143,8 @@ contract RemoteAddressValidator is IRemoteAddressValidator, Upgradable { function removeTrustedAddress(string calldata sourceChain) external onlyOwner { if (bytes(sourceChain).length == 0) revert ZeroStringLength(); - remoteAddressHashes[sourceChain] = bytes32(0); - remoteAddresses[sourceChain] = ''; + delete remoteAddressHashes[sourceChain]; + delete remoteAddresses[sourceChain]; emit TrustedAddressRemoved(sourceChain); } diff --git a/contracts/test/FeeOnTransferTokenTest.sol b/contracts/test/FeeOnTransferTokenTest.sol index a5163a1f..d0816dd1 100644 --- a/contracts/test/FeeOnTransferTokenTest.sol +++ b/contracts/test/FeeOnTransferTokenTest.sol @@ -10,6 +10,7 @@ import { IERC20BurnableMintable } from '../interfaces/IERC20BurnableMintable.sol contract FeeOnTransferTokenTest is InterchainToken, Distributable, IERC20BurnableMintable { ITokenManager public tokenManager_; bool internal tokenManagerRequiresApproval_ = true; + string public name; string public symbol; uint8 public decimals; @@ -36,9 +37,9 @@ contract FeeOnTransferTokenTest is InterchainToken, Distributable, IERC20Burnabl if (!tokenManagerRequiresApproval_) return; address tokenManagerAddress = address(tokenManager_); uint256 allowance_ = allowance[sender][tokenManagerAddress]; - if (allowance_ != type(uint256).max) { - if (allowance_ > type(uint256).max - amount) { - allowance_ = type(uint256).max - amount; + if (allowance_ != UINT256_MAX) { + if (allowance_ > UINT256_MAX - amount) { + allowance_ = UINT256_MAX - amount; } _approve(sender, tokenManagerAddress, allowance_ + amount); diff --git a/contracts/test/InterchainTokenTest.sol b/contracts/test/InterchainTokenTest.sol index 53c369c2..96fa8cbb 100644 --- a/contracts/test/InterchainTokenTest.sol +++ b/contracts/test/InterchainTokenTest.sol @@ -36,9 +36,9 @@ contract InterchainTokenTest is InterchainToken, Distributable, IERC20BurnableMi if (!tokenManagerRequiresApproval_) return; address tokenManagerAddress = address(tokenManager_); uint256 allowance_ = allowance[sender][tokenManagerAddress]; - if (allowance_ != type(uint256).max) { - if (allowance_ > type(uint256).max - amount) { - allowance_ = type(uint256).max - amount; + if (allowance_ != UINT256_MAX) { + if (allowance_ > UINT256_MAX - amount) { + allowance_ = UINT256_MAX - amount; } _approve(sender, tokenManagerAddress, allowance_ + amount); diff --git a/contracts/token-implementations/ERC20.sol b/contracts/token-implementations/ERC20.sol index 66be0690..71b7f10d 100644 --- a/contracts/token-implementations/ERC20.sol +++ b/contracts/token-implementations/ERC20.sol @@ -34,6 +34,7 @@ contract ERC20 is IERC20 { mapping(address => mapping(address => uint256)) public override allowance; uint256 public override totalSupply; + uint256 internal constant UINT256_MAX = 2 ** 256 - 1; /** * @dev See {IERC20-transfer}. @@ -79,7 +80,7 @@ contract ERC20 is IERC20 { function transferFrom(address sender, address recipient, uint256 amount) external virtual override returns (bool) { uint256 _allowance = allowance[sender][msg.sender]; - if (_allowance != type(uint256).max) { + if (_allowance != UINT256_MAX) { _approve(sender, msg.sender, _allowance - amount); } diff --git a/contracts/token-implementations/StandardizedToken.sol b/contracts/token-implementations/StandardizedToken.sol index 8d291a00..f1fe4951 100644 --- a/contracts/token-implementations/StandardizedToken.sol +++ b/contracts/token-implementations/StandardizedToken.sol @@ -19,10 +19,10 @@ import { Distributable } from '../utils/Distributable.sol'; contract StandardizedToken is IERC20BurnableMintable, InterchainToken, ERC20Permit, Implementation, Distributable { using AddressBytesUtils for bytes; - address internal tokenManager_; string public name; string public symbol; uint8 public decimals; + address internal tokenManager_; bytes32 private constant CONTRACT_ID = keccak256('standardized-token'); diff --git a/contracts/token-manager/implementations/TokenManagerAddressStorage.sol b/contracts/token-manager/implementations/TokenManagerAddressStorage.sol index a7a1d32f..23a1559f 100644 --- a/contracts/token-manager/implementations/TokenManagerAddressStorage.sol +++ b/contracts/token-manager/implementations/TokenManagerAddressStorage.sol @@ -3,8 +3,6 @@ pragma solidity ^0.8.0; import { TokenManager } from '../TokenManager.sol'; -import { IERC20 } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IERC20.sol'; -import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol'; /** * @title TokenManagerAddressStorage diff --git a/contracts/token-manager/implementations/TokenManagerLiquidityPool.sol b/contracts/token-manager/implementations/TokenManagerLiquidityPool.sol index 4f552462..1539fa9f 100644 --- a/contracts/token-manager/implementations/TokenManagerLiquidityPool.sol +++ b/contracts/token-manager/implementations/TokenManagerLiquidityPool.sol @@ -98,7 +98,7 @@ contract TokenManagerLiquidityPool is TokenManagerAddressStorage, NoReEntrancy { */ function _giveToken(address to, uint256 amount) internal override noReEntrancy returns (uint256) { IERC20 token = IERC20(tokenAddress()); - uint256 balance = IERC20(token).balanceOf(to); + uint256 balance = token.balanceOf(to); SafeTokenTransferFrom.safeTransferFrom(token, liquidityPool(), to, amount); diff --git a/contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol b/contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol index b1db1cd9..01b21ab5 100644 --- a/contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol +++ b/contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol @@ -63,7 +63,7 @@ contract TokenManagerLockUnlockFee is TokenManagerAddressStorage, NoReEntrancy { */ function _giveToken(address to, uint256 amount) internal override noReEntrancy returns (uint256) { IERC20 token = IERC20(tokenAddress()); - uint256 balance = IERC20(token).balanceOf(to); + uint256 balance = token.balanceOf(to); SafeTokenTransfer.safeTransfer(token, to, amount);