creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IContractIdentifier.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n// General interface for upgradable contracts\ninterface IContractIdentifier {\n    /**\n     * @notice Returns the contract ID. It can be used as a check during upgrades.\n     * @dev Meant to be overridden in derived contracts.\n     * @return bytes32 The contract ID\n     */\n    function contractId() external pure returns (bytes32);\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    error InvalidAccount();\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address sender,\n        address recipient,\n        uint256 amount\n    ) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IImplementation.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IContractIdentifier } from './IContractIdentifier.sol';\n\ninterface IImplementation is IContractIdentifier {\n    error NotProxy();\n\n    function setup(bytes calldata data) external;\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IRolesBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title IRolesBase Interface\n * @notice IRolesBase is an interface that abstracts the implementation of a\n * contract with role control internal functions.\n */\ninterface IRolesBase {\n    error MissingRole(address account, uint8 role);\n    error MissingAllRoles(address account, uint256 accountRoles);\n    error MissingAnyOfRoles(address account, uint256 accountRoles);\n\n    error InvalidProposedRoles(address fromAccount, address toAccount, uint256 accountRoles);\n\n    event RolesProposed(address indexed fromAccount, address indexed toAccount, uint256 accountRoles);\n    event RolesAdded(address indexed account, uint256 accountRoles);\n    event RolesRemoved(address indexed account, uint256 accountRoles);\n\n    /**\n     * @notice Checks if an account has a role.\n     * @param account The address to check\n     * @param role The role to check\n     * @return True if the account has the role, false otherwise\n     */\n    function hasRole(address account, uint8 role) external view returns (bool);\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/AddressBytes.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title AddressBytesUtils\n * @dev This library provides utility functions to convert between `address` and `bytes`.\n */\nlibrary AddressBytes {\n    error InvalidBytesLength(bytes bytesAddress);\n\n    /**\n     * @dev Converts a bytes address to an address type.\n     * @param bytesAddress The bytes representation of an address\n     * @return addr The converted address\n     */\n    function toAddress(bytes memory bytesAddress) internal pure returns (address addr) {\n        if (bytesAddress.length != 20) revert InvalidBytesLength(bytesAddress);\n\n        assembly {\n            addr := mload(add(bytesAddress, 20))\n        }\n    }\n\n    /**\n     * @dev Converts an address to bytes.\n     * @param addr The address to be converted\n     * @return bytesAddress The bytes representation of the address\n     */\n    function toBytes(address addr) internal pure returns (bytes memory bytesAddress) {\n        bytesAddress = new bytes(20);\n        // we can test if using a single 32 byte variable that is the address with the length together and using one mstore would be slightly cheaper.\n        assembly {\n            mstore(add(bytesAddress, 20), addr)\n            mstore(bytesAddress, 20)\n        }\n    }\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IERC20 } from '../interfaces/IERC20.sol';\n\nerror TokenTransferFailed();\n\n/*\n * @title SafeTokenCall\n * @dev This library is used for performing safe token transfers.\n */\nlibrary SafeTokenCall {\n    /*\n     * @notice Make a safe call to a token contract.\n     * @param token The token contract to interact with.\n     * @param callData The function call data.\n     * @throws TokenTransferFailed error if transfer of token is not successful.\n     */\n    function safeCall(IERC20 token, bytes memory callData) internal {\n        (bool success, bytes memory returnData) = address(token).call(callData);\n        bool transferred = success && (returnData.length == uint256(0) || abi.decode(returnData, (bool)));\n\n        if (!transferred || address(token).code.length == 0) revert TokenTransferFailed();\n    }\n}\n\n/*\n * @title SafeTokenTransfer\n * @dev This library safely transfers tokens from the contract to a recipient.\n */\nlibrary SafeTokenTransfer {\n    /*\n     * @notice Transfer tokens to a recipient.\n     * @param token The token contract.\n     * @param receiver The recipient of the tokens.\n     * @param amount The amount of tokens to transfer.\n     */\n    function safeTransfer(\n        IERC20 token,\n        address receiver,\n        uint256 amount\n    ) internal {\n        SafeTokenCall.safeCall(token, abi.encodeWithSelector(IERC20.transfer.selector, receiver, amount));\n    }\n}\n\n/*\n * @title SafeTokenTransferFrom\n * @dev This library helps to safely transfer tokens on behalf of a token holder.\n */\nlibrary SafeTokenTransferFrom {\n    /*\n     * @notice Transfer tokens on behalf of a token holder.\n     * @param token The token contract.\n     * @param from The address of the token holder.\n     * @param to The address the tokens are to be sent to.\n     * @param amount The amount of tokens to be transferred.\n     */\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 amount\n    ) internal {\n        SafeTokenCall.safeCall(token, abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, amount));\n    }\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Implementation.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IImplementation } from '../interfaces/IImplementation.sol';\n\n/**\n * @title Implementation\n * @notice This contract serves as a base for other contracts and enforces a proxy-first access restriction.\n * @dev Derived contracts must implement the setup function.\n */\nabstract contract Implementation is IImplementation {\n    address private immutable implementationAddress;\n\n    /**\n     * @dev Contract constructor that sets the implementation address to the address of this contract.\n     */\n    constructor() {\n        implementationAddress = address(this);\n    }\n\n    /**\n     * @dev Modifier to require the caller to be the proxy contract.\n     * Reverts if the caller is the current contract (i.e., the implementation contract itself).\n     */\n    modifier onlyProxy() {\n        if (implementationAddress == address(this)) revert NotProxy();\n        _;\n    }\n\n    /**\n     * @notice Initializes contract parameters.\n     * This function is intended to be overridden by derived contracts.\n     * The overriding function must have the onlyProxy modifier.\n     * @param params The parameters to be used for initialization\n     */\n    function setup(bytes calldata params) external virtual;\n}\n"
      },
      "@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/RolesBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IRolesBase } from '../interfaces/IRolesBase.sol';\n\n/**\n * @title RolesBase\n * @notice A contract module which provides a set if internal functions\n * for implementing role control features.\n */\ncontract RolesBase is IRolesBase {\n    bytes32 internal constant ROLES_PREFIX = keccak256('roles');\n    bytes32 internal constant PROPOSE_ROLES_PREFIX = keccak256('propose-roles');\n\n    /**\n     * @notice Modifier that throws an error if called by any account missing the role.\n     */\n    modifier onlyRole(uint8 role) {\n        if (!_hasRole(_getRoles(msg.sender), role)) revert MissingRole(msg.sender, role);\n\n        _;\n    }\n\n    /**\n     * @notice Modifier that throws an error if called by an account without all the roles.\n     */\n    modifier withEveryRole(uint8[] memory roles) {\n        uint256 accountRoles = _toAccountRoles(roles);\n        if (!_hasAllTheRoles(_getRoles(msg.sender), accountRoles)) revert MissingAllRoles(msg.sender, accountRoles);\n\n        _;\n    }\n\n    /**\n     * @notice Modifier that throws an error if called by an account without any of the roles.\n     */\n    modifier withAnyRole(uint8[] memory roles) {\n        uint256 accountRoles = _toAccountRoles(roles);\n        if (!_hasAnyOfRoles(_getRoles(msg.sender), accountRoles)) revert MissingAnyOfRoles(msg.sender, accountRoles);\n\n        _;\n    }\n\n    /**\n     * @notice Checks if an account has a role.\n     * @param account The address to check\n     * @param role The role to check\n     * @return True if the account has the role, false otherwise\n     */\n    function hasRole(address account, uint8 role) public view returns (bool) {\n        return _hasRole(_getRoles(account), role);\n    }\n\n    /**\n     * @notice Internal function to convert an array of roles to a uint256.\n     * @param roles The roles to convert\n     * @return accountRoles The roles in uint256 format\n     */\n    function _toAccountRoles(uint8[] memory roles) internal pure returns (uint256) {\n        uint256 length = roles.length;\n        uint256 accountRoles;\n\n        for (uint256 i = 0; i < length; ++i) {\n            accountRoles |= (1 << roles[i]);\n        }\n\n        return accountRoles;\n    }\n\n    /**\n     * @notice Internal function to get the key of the roles mapping.\n     * @param account The address to get the key for\n     * @return key The key of the roles mapping\n     */\n    function _rolesKey(address account) internal view virtual returns (bytes32 key) {\n        return keccak256(abi.encodePacked(ROLES_PREFIX, account));\n    }\n\n    /**\n     * @notice Internal function to get the roles of an account.\n     * @param account The address to get the roles for\n     * @return accountRoles The roles of the account in uint256 format\n     */\n    function _getRoles(address account) internal view returns (uint256 accountRoles) {\n        bytes32 key = _rolesKey(account);\n        assembly {\n            accountRoles := sload(key)\n        }\n    }\n\n    /**\n     * @notice Internal function to set the roles of an account.\n     * @param account The address to set the roles for\n     * @param accountRoles The roles to set\n     */\n    function _setRoles(address account, uint256 accountRoles) private {\n        bytes32 key = _rolesKey(account);\n        assembly {\n            sstore(key, accountRoles)\n        }\n    }\n\n    /**\n     * @notice Internal function to get the key of the proposed roles mapping.\n     * @param fromAccount The address of the current role\n     * @param toAccount The address of the pending role\n     * @return key The key of the proposed roles mapping\n     */\n    function _proposalKey(address fromAccount, address toAccount) internal view virtual returns (bytes32 key) {\n        return keccak256(abi.encodePacked(PROPOSE_ROLES_PREFIX, fromAccount, toAccount));\n    }\n\n    /**\n     * @notice Internal function to get the proposed roles of an account.\n     * @param fromAccount The address of the current role\n     * @param toAccount The address of the pending role\n     * @return proposedRoles_ The proposed roles of the account in uint256 format\n     */\n    function _getProposedRoles(address fromAccount, address toAccount) internal view returns (uint256 proposedRoles_) {\n        bytes32 key = _proposalKey(fromAccount, toAccount);\n        assembly {\n            proposedRoles_ := sload(key)\n        }\n    }\n\n    /**\n     * @notice Internal function to set the proposed roles of an account.\n     * @param fromAccount The address of the current role\n     * @param toAccount The address of the pending role\n     * @param proposedRoles_ The proposed roles to set in uint256 format\n     */\n    function _setProposedRoles(\n        address fromAccount,\n        address toAccount,\n        uint256 proposedRoles_\n    ) private {\n        bytes32 key = _proposalKey(fromAccount, toAccount);\n        assembly {\n            sstore(key, proposedRoles_)\n        }\n    }\n\n    /**\n     * @notice Internal function to add a role to an account.\n     * @dev emits a RolesAdded event.\n     * @param account The address to add the role to\n     * @param role The role to add\n     */\n    function _addRole(address account, uint8 role) internal {\n        _addAccountRoles(account, 1 << role);\n    }\n\n    /**\n     * @notice Internal function to add roles to an account.\n     * @dev emits a RolesAdded event.\n     * @dev Called in the constructor to set the initial roles.\n     * @param account The address to add roles to\n     * @param roles The roles to add\n     */\n    function _addRoles(address account, uint8[] memory roles) internal {\n        _addAccountRoles(account, _toAccountRoles(roles));\n    }\n\n    /**\n     * @notice Internal function to add roles to an account.\n     * @dev emits a RolesAdded event.\n     * @dev Called in the constructor to set the initial roles.\n     * @param account The address to add roles to\n     * @param accountRoles The roles to add\n     */\n    function _addAccountRoles(address account, uint256 accountRoles) internal {\n        uint256 newAccountRoles = _getRoles(account) | accountRoles;\n\n        _setRoles(account, newAccountRoles);\n\n        emit RolesAdded(account, accountRoles);\n    }\n\n    /**\n     * @notice Internal function to remove a role from an account.\n     * @dev emits a RolesRemoved event.\n     * @param account The address to remove the role from\n     * @param role The role to remove\n     */\n    function _removeRole(address account, uint8 role) internal {\n        _removeAccountRoles(account, 1 << role);\n    }\n\n    /**\n     * @notice Internal function to remove roles from an account.\n     * @dev emits a RolesRemoved event.\n     * @param account The address to remove roles from\n     * @param roles The roles to remove\n     */\n    function _removeRoles(address account, uint8[] memory roles) internal {\n        _removeAccountRoles(account, _toAccountRoles(roles));\n    }\n\n    /**\n     * @notice Internal function to remove roles from an account.\n     * @dev emits a RolesRemoved event.\n     * @param account The address to remove roles from\n     * @param accountRoles The roles to remove\n     */\n    function _removeAccountRoles(address account, uint256 accountRoles) internal {\n        uint256 newAccountRoles = _getRoles(account) & ~accountRoles;\n\n        _setRoles(account, newAccountRoles);\n\n        emit RolesRemoved(account, accountRoles);\n    }\n\n    /**\n     * @notice Internal function to check if an account has a role.\n     * @param accountRoles The roles of the account in uint256 format\n     * @param role The role to check\n     * @return True if the account has the role, false otherwise\n     */\n    function _hasRole(uint256 accountRoles, uint8 role) internal pure returns (bool) {\n        return accountRoles & (1 << role) != 0;\n    }\n\n    /**\n     * @notice Internal function to check if an account has all the roles.\n     * @param hasAccountRoles The roles of the account in uint256 format\n     * @param mustHaveAccountRoles The roles the account must have\n     * @return True if the account has all the roles, false otherwise\n     */\n    function _hasAllTheRoles(uint256 hasAccountRoles, uint256 mustHaveAccountRoles) internal pure returns (bool) {\n        return (hasAccountRoles & mustHaveAccountRoles) == mustHaveAccountRoles;\n    }\n\n    /**\n     * @notice Internal function to check if an account has any of the roles.\n     * @param hasAccountRoles The roles of the account in uint256 format\n     * @param mustHaveAnyAccountRoles The roles to check in uint256 format\n     * @return True if the account has any of the roles, false otherwise\n     */\n    function _hasAnyOfRoles(uint256 hasAccountRoles, uint256 mustHaveAnyAccountRoles) internal pure returns (bool) {\n        return (hasAccountRoles & mustHaveAnyAccountRoles) != 0;\n    }\n\n    /**\n     * @notice Internal function to propose to transfer roles of message sender to a new account.\n     * @dev Original account must have all the proposed roles.\n     * @dev Emits a RolesProposed event.\n     * @dev Roles are not transferred until the new role accepts the role transfer.\n     * @param fromAccount The address of the current roles\n     * @param toAccount The address to transfer roles to\n     * @param role The role to transfer\n     */\n    function _proposeRole(\n        address fromAccount,\n        address toAccount,\n        uint8 role\n    ) internal {\n        _proposeAccountRoles(fromAccount, toAccount, 1 << role);\n    }\n\n    /**\n     * @notice Internal function to propose to transfer roles of message sender to a new account.\n     * @dev Original account must have all the proposed roles.\n     * @dev Emits a RolesProposed event.\n     * @dev Roles are not transferred until the new role accepts the role transfer.\n     * @param fromAccount The address of the current roles\n     * @param toAccount The address to transfer roles to\n     * @param roles The roles to transfer\n     */\n    function _proposeRoles(\n        address fromAccount,\n        address toAccount,\n        uint8[] memory roles\n    ) internal {\n        _proposeAccountRoles(fromAccount, toAccount, _toAccountRoles(roles));\n    }\n\n    /**\n     * @notice Internal function to propose to transfer roles of message sender to a new account.\n     * @dev Original account must have all the proposed roles.\n     * @dev Emits a RolesProposed event.\n     * @dev Roles are not transferred until the new role accepts the role transfer.\n     * @param fromAccount The address of the current roles\n     * @param toAccount The address to transfer roles to\n     * @param accountRoles The account roles to transfer\n     */\n    function _proposeAccountRoles(\n        address fromAccount,\n        address toAccount,\n        uint256 accountRoles\n    ) internal {\n        if (!_hasAllTheRoles(_getRoles(fromAccount), accountRoles)) revert MissingAllRoles(fromAccount, accountRoles);\n\n        _setProposedRoles(fromAccount, toAccount, accountRoles);\n\n        emit RolesProposed(fromAccount, toAccount, accountRoles);\n    }\n\n    /**\n     * @notice Internal function to accept roles transferred from another account.\n     * @dev Pending account needs to pass all the proposed roles.\n     * @dev Emits RolesRemoved and RolesAdded events.\n     * @param fromAccount The address of the current role\n     * @param role The role to accept\n     */\n    function _acceptRole(\n        address fromAccount,\n        address toAccount,\n        uint8 role\n    ) internal virtual {\n        _acceptAccountRoles(fromAccount, toAccount, 1 << role);\n    }\n\n    /**\n     * @notice Internal function to accept roles transferred from another account.\n     * @dev Pending account needs to pass all the proposed roles.\n     * @dev Emits RolesRemoved and RolesAdded events.\n     * @param fromAccount The address of the current role\n     * @param roles The roles to accept\n     */\n    function _acceptRoles(\n        address fromAccount,\n        address toAccount,\n        uint8[] memory roles\n    ) internal virtual {\n        _acceptAccountRoles(fromAccount, toAccount, _toAccountRoles(roles));\n    }\n\n    /**\n     * @notice Internal function to accept roles transferred from another account.\n     * @dev Pending account needs to pass all the proposed roles.\n     * @dev Emits RolesRemoved and RolesAdded events.\n     * @param fromAccount The address of the current role\n     * @param accountRoles The account roles to accept\n     */\n    function _acceptAccountRoles(\n        address fromAccount,\n        address toAccount,\n        uint256 accountRoles\n    ) internal virtual {\n        if (_getProposedRoles(fromAccount, toAccount) != accountRoles) {\n            revert InvalidProposedRoles(fromAccount, toAccount, accountRoles);\n        }\n\n        _setProposedRoles(fromAccount, toAccount, 0);\n        _transferAccountRoles(fromAccount, toAccount, accountRoles);\n    }\n\n    /**\n     * @notice Internal function to transfer roles from one account to another.\n     * @dev Original account must have all the proposed roles.\n     * @param fromAccount The address of the current role\n     * @param toAccount The address to transfer role to\n     * @param role The role to transfer\n     */\n    function _transferRole(\n        address fromAccount,\n        address toAccount,\n        uint8 role\n    ) internal {\n        _transferAccountRoles(fromAccount, toAccount, 1 << role);\n    }\n\n    /**\n     * @notice Internal function to transfer roles from one account to another.\n     * @dev Original account must have all the proposed roles.\n     * @param fromAccount The address of the current role\n     * @param toAccount The address to transfer role to\n     * @param roles The roles to transfer\n     */\n    function _transferRoles(\n        address fromAccount,\n        address toAccount,\n        uint8[] memory roles\n    ) internal {\n        _transferAccountRoles(fromAccount, toAccount, _toAccountRoles(roles));\n    }\n\n    /**\n     * @notice Internal function to transfer roles from one account to another.\n     * @dev Original account must have all the proposed roles.\n     * @param fromAccount The address of the current role\n     * @param toAccount The address to transfer role to\n     * @param accountRoles The account roles to transfer\n     */\n    function _transferAccountRoles(\n        address fromAccount,\n        address toAccount,\n        uint256 accountRoles\n    ) internal {\n        if (!_hasAllTheRoles(_getRoles(fromAccount), accountRoles)) revert MissingAllRoles(fromAccount, accountRoles);\n\n        _removeAccountRoles(fromAccount, accountRoles);\n        _addAccountRoles(toAccount, accountRoles);\n    }\n}\n"
      },
      "contracts/interfaces/IBaseTokenManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title IBaseTokenManager\n * @notice This contract is defines the base token manager interface implemented by all token managers.\n */\ninterface IBaseTokenManager {\n    /**\n     * @notice A function that returns the token id.\n     */\n    function interchainTokenId() external view returns (bytes32);\n\n    /**\n     * @notice A function that should return the address of the token.\n     * Must be overridden in the inheriting contract.\n     * @return address address of the token.\n     */\n    function tokenAddress() external view returns (address);\n\n    /**\n     * @notice A function that should return the token address from the init params.\n     */\n    function getTokenAddressFromParams(bytes calldata params) external pure returns (address);\n}\n"
      },
      "contracts/interfaces/IERC20MintableBurnable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title IERC20MintableBurnable Interface\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20MintableBurnable {\n    /**\n     * @notice Function to mint new tokens.\n     * @dev Can only be called by the minter address.\n     * @param to The address that will receive the minted tokens.\n     * @param amount The amount of tokens to mint.\n     */\n    function mint(address to, uint256 amount) external;\n\n    /**\n     * @notice Function to burn tokens.\n     * @dev Can only be called by the minter address.\n     * @param from The address that will have its tokens burnt.\n     * @param amount The amount of tokens to burn.\n     */\n    function burn(address from, uint256 amount) external;\n}\n"
      },
      "contracts/interfaces/IFlowLimit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title FlowLimit Interface\n * @notice Interface for flow limit logic for interchain token transfers.\n */\ninterface IFlowLimit {\n    error FlowLimitExceeded(uint256 limit, uint256 flowAmount, address tokenManager);\n\n    event FlowLimitSet(bytes32 indexed tokenId, address operator, uint256 flowLimit_);\n\n    /**\n     * @notice Returns the current flow limit.\n     * @return flowLimit_ The current flow limit value.\n     */\n    function flowLimit() external view returns (uint256 flowLimit_);\n\n    /**\n     * @notice Returns the current flow out amount.\n     * @return flowOutAmount_ The current flow out amount.\n     */\n    function flowOutAmount() external view returns (uint256 flowOutAmount_);\n\n    /**\n     * @notice Returns the current flow in amount.\n     * @return flowInAmount_ The current flow in amount.\n     */\n    function flowInAmount() external view returns (uint256 flowInAmount_);\n}\n"
      },
      "contracts/interfaces/IOperator.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IRolesBase } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IRolesBase.sol';\n\n/**\n * @title IOperator Interface\n * @notice An interface for a contract module which provides a basic access control mechanism, where\n * there is an account (a operator) that can be granted exclusive access to specific functions.\n */\ninterface IOperator is IRolesBase {\n    /**\n     * @notice Change the operator of the contract.\n     * @dev Can only be called by the current operator.\n     * @param operator_ The address of the new operator.\n     */\n    function transferOperatorship(address operator_) external;\n\n    /**\n     * @notice Proposed a change of the operator of the contract.\n     * @dev Can only be called by the current operator.\n     * @param operator_ The address of the new operator.\n     */\n    function proposeOperatorship(address operator_) external;\n\n    /**\n     * @notice Accept a proposed change of operatorship.\n     * @dev Can only be called by the proposed operator.\n     * @param fromOperator The previous operator of the contract.\n     */\n    function acceptOperatorship(address fromOperator) external;\n\n    /**\n     * @notice Query if an address is a operator.\n     * @param addr The address to query for.\n     * @return bool Boolean value representing whether or not the address is an operator.\n     */\n    function isOperator(address addr) external view returns (bool);\n}\n"
      },
      "contracts/interfaces/ITokenManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IImplementation } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IImplementation.sol';\n\nimport { IBaseTokenManager } from './IBaseTokenManager.sol';\nimport { IOperator } from './IOperator.sol';\nimport { IFlowLimit } from './IFlowLimit.sol';\n\n/**\n * @title ITokenManager Interface\n * @notice This contract is responsible for managing tokens, such as setting locking token balances, or setting flow limits, for interchain transfers.\n */\ninterface ITokenManager is IBaseTokenManager, IOperator, IFlowLimit, IImplementation {\n    error TokenLinkerZeroAddress();\n    error NotService(address caller);\n    error TakeTokenFailed();\n    error GiveTokenFailed();\n    error NotToken(address caller);\n    error ZeroAddress();\n    error AlreadyFlowLimiter(address flowLimiter);\n    error NotFlowLimiter(address flowLimiter);\n    error NotSupported();\n\n    /**\n     * @notice Returns implementation type of this token manager.\n     * @return uint256 The implementation type of this token manager.\n     */\n    function implementationType() external view returns (uint256);\n\n    function addFlowIn(uint256 amount) external;\n\n    function addFlowOut(uint256 amount) external;\n\n    /**\n     * @notice This function adds a flow limiter for this TokenManager.\n     * @dev Can only be called by the operator.\n     * @param flowLimiter the address of the new flow limiter.\n     */\n    function addFlowLimiter(address flowLimiter) external;\n\n    /**\n     * @notice This function removes a flow limiter for this TokenManager.\n     * @dev Can only be called by the operator.\n     * @param flowLimiter the address of an existing flow limiter.\n     */\n    function removeFlowLimiter(address flowLimiter) external;\n\n    /**\n     * @notice Query if an address is a flow limiter.\n     * @param addr The address to query for.\n     * @return bool Boolean value representing whether or not the address is a flow limiter.\n     */\n    function isFlowLimiter(address addr) external view returns (bool);\n\n    /**\n     * @notice This function sets the flow limit for this TokenManager.\n     * @dev Can only be called by the flow limiters.\n     * @param flowLimit_ The maximum difference between the tokens flowing in and/or out at any given interval of time (6h).\n     */\n    function setFlowLimit(uint256 flowLimit_) external;\n\n    /**\n     * @notice A function to renew approval to the service if we need to.\n     */\n    function approveService() external;\n\n    /**\n     * @notice Getter function for the parameters of a lock/unlock TokenManager.\n     * @dev This function will be mainly used by frontends.\n     * @param operator_ The operator of the TokenManager.\n     * @param tokenAddress_ The token to be managed.\n     * @return params_ The resulting params to be passed to custom TokenManager deployments.\n     */\n    function params(bytes calldata operator_, address tokenAddress_) external pure returns (bytes memory params_);\n\n    /**\n     * @notice External function to allow the service to mint tokens through the tokenManager\n     * @dev This function should revert if called by anyone but the service.\n     * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager.\n     * @param to The recipient.\n     * @param amount The amount to mint.\n     */\n    function mintToken(address tokenAddress_, address to, uint256 amount) external;\n\n    /**\n     * @notice External function to allow the service to burn tokens through the tokenManager\n     * @dev This function should revert if called by anyone but the service.\n     * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager.\n     * @param from The address to burn the token from.\n     * @param amount The amount to burn.\n     */\n    function burnToken(address tokenAddress_, address from, uint256 amount) external;\n}\n"
      },
      "contracts/token-manager/TokenManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IERC20 } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IERC20.sol';\nimport { AddressBytes } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/AddressBytes.sol';\nimport { IImplementation } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IImplementation.sol';\nimport { Implementation } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Implementation.sol';\nimport { SafeTokenCall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol';\n\nimport { ITokenManager } from '../interfaces/ITokenManager.sol';\nimport { IERC20MintableBurnable } from '../interfaces/IERC20MintableBurnable.sol';\n\nimport { Operator } from '../utils/Operator.sol';\nimport { FlowLimit } from '../utils/FlowLimit.sol';\n\n/**\n * @title TokenManager\n * @notice This contract is responsible for managing tokens, such as setting locking token balances, or setting flow limits, for interchain transfers.\n */\ncontract TokenManager is ITokenManager, Operator, FlowLimit, Implementation {\n    using AddressBytes for bytes;\n    using SafeTokenCall for IERC20;\n\n    uint256 internal constant UINT256_MAX = type(uint256).max;\n\n    address public immutable interchainTokenService;\n\n    bytes32 private constant CONTRACT_ID = keccak256('token-manager');\n\n    /**\n     * @notice Constructs the TokenManager contract.\n     * @param interchainTokenService_ The address of the interchain token service.\n     */\n    constructor(address interchainTokenService_) {\n        if (interchainTokenService_ == address(0)) revert TokenLinkerZeroAddress();\n\n        interchainTokenService = interchainTokenService_;\n    }\n\n    /**\n     * @notice A modifier that allows only the interchain token service to execute the function.\n     */\n    modifier onlyService() {\n        if (msg.sender != interchainTokenService) revert NotService(msg.sender);\n        _;\n    }\n\n    /**\n     * @notice Getter for the contract id.\n     * @return bytes32 The contract id.\n     */\n    function contractId() external pure override returns (bytes32) {\n        return CONTRACT_ID;\n    }\n\n    /**\n     * @notice Reads the token address from the proxy.\n     * @dev This function is not supported when directly called on the implementation. It\n     * must be called by the proxy.\n     * @return tokenAddress_ The address of the token.\n     */\n    function tokenAddress() external view virtual returns (address) {\n        revert NotSupported();\n    }\n\n    /**\n     * @notice A function that returns the token id.\n     * @dev This will only work when implementation is called by a proxy, which stores the tokenId as an immutable.\n     * @return bytes32 The interchain token ID.\n     */\n    function interchainTokenId() public pure returns (bytes32) {\n        revert NotSupported();\n    }\n\n    /**\n     * @notice Returns implementation type of this token manager.\n     * @return uint256 The implementation type of this token manager.\n     */\n    function implementationType() external pure returns (uint256) {\n        revert NotSupported();\n    }\n\n    /**\n     * @notice A function that should return the token address from the setup params.\n     * @param params_ The setup parameters.\n     * @return tokenAddress_ The token address.\n     */\n    function getTokenAddressFromParams(bytes calldata params_) external pure returns (address tokenAddress_) {\n        (, tokenAddress_) = abi.decode(params_, (bytes, address));\n    }\n\n    /**\n     * @notice Setup function for the TokenManager.\n     * @dev This function should only be called by the proxy, and only once from the proxy constructor.\n     * The exact format of params depends on the type of TokenManager used but the first 32 bytes are reserved\n     * for the address of the operator, stored as bytes (to be compatible with non-EVM chains)\n     * @param params_ The parameters to be used to initialize the TokenManager.\n     */\n    function setup(bytes calldata params_) external override(Implementation, IImplementation) onlyProxy {\n        bytes memory operatorBytes = abi.decode(params_, (bytes));\n\n        address operator = address(0);\n\n        if (operatorBytes.length != 0) {\n            operator = operatorBytes.toAddress();\n        }\n\n        // If an operator is not provided, set `address(0)` as the operator.\n        // This allows anyone to easily check if a custom operator was set on the token manager.\n        _addAccountRoles(operator, (1 << uint8(Roles.FLOW_LIMITER)) | (1 << uint8(Roles.OPERATOR)));\n        // Add operator and flow limiter role to the service. The operator can remove the flow limiter role if they so chose and the service has no way to use the operator role for now.\n        _addAccountRoles(interchainTokenService, (1 << uint8(Roles.FLOW_LIMITER)) | (1 << uint8(Roles.OPERATOR)));\n    }\n\n    function addFlowIn(uint256 amount) external onlyService {\n        _addFlowIn(amount);\n    }\n\n    function addFlowOut(uint256 amount) external onlyService {\n        _addFlowOut(amount);\n    }\n\n    /**\n     * @notice This function adds a flow limiter for this TokenManager.\n     * @dev Can only be called by the operator.\n     * @param flowLimiter the address of the new flow limiter.\n     */\n    function addFlowLimiter(address flowLimiter) external onlyRole(uint8(Roles.OPERATOR)) {\n        _addRole(flowLimiter, uint8(Roles.FLOW_LIMITER));\n    }\n\n    /**\n     * @notice This function removes a flow limiter for this TokenManager.\n     * @dev Can only be called by the operator.\n     * @param flowLimiter the address of an existing flow limiter.\n     */\n    function removeFlowLimiter(address flowLimiter) external onlyRole(uint8(Roles.OPERATOR)) {\n        _removeRole(flowLimiter, uint8(Roles.FLOW_LIMITER));\n    }\n\n    /**\n     * @notice Query if an address is a flow limiter.\n     * @param addr The address to query for.\n     * @return bool Boolean value representing whether or not the address is a flow limiter.\n     */\n    function isFlowLimiter(address addr) external view returns (bool) {\n        return hasRole(addr, uint8(Roles.FLOW_LIMITER));\n    }\n\n    /**\n     * @notice This function sets the flow limit for this TokenManager.\n     * @dev Can only be called by the flow limiters.\n     * @param flowLimit_ The maximum difference between the tokens flowing in and/or out at any given interval of time (6h).\n     */\n    function setFlowLimit(uint256 flowLimit_) external onlyRole(uint8(Roles.FLOW_LIMITER)) {\n        // slither-disable-next-line var-read-using-this\n        _setFlowLimit(flowLimit_, this.interchainTokenId());\n    }\n\n    /**\n     * @notice A function to renew approval to the service if we need to.\n     */\n    function approveService() external onlyService {\n        /**\n         * @dev Some tokens may not obey the infinite approval.\n         * Even so, it is unexpected to run out of allowance in practice.\n         * If needed, we can upgrade to allow replenishing the allowance in the future.\n         */\n        IERC20(this.tokenAddress()).safeCall(abi.encodeWithSelector(IERC20.approve.selector, interchainTokenService, UINT256_MAX));\n    }\n\n    /**\n     * @notice Getter function for the parameters of a lock/unlock TokenManager.\n     * @dev This function will be mainly used by frontends.\n     * @param operator_ The operator of the TokenManager.\n     * @param tokenAddress_ The token to be managed.\n     * @return params_ The resulting params to be passed to custom TokenManager deployments.\n     */\n    function params(bytes calldata operator_, address tokenAddress_) external pure returns (bytes memory params_) {\n        params_ = abi.encode(operator_, tokenAddress_);\n    }\n\n    /**\n     * @notice External function to allow the service to mint tokens through the tokenManager\n     * @dev This function should revert if called by anyone but the service.\n     * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager.\n     * @param to The recipient.\n     * @param amount The amount to mint.\n     */\n    function mintToken(address tokenAddress_, address to, uint256 amount) external onlyService {\n        IERC20(tokenAddress_).safeCall(abi.encodeWithSelector(IERC20MintableBurnable.mint.selector, to, amount));\n    }\n\n    /**\n     * @notice External function to allow the service to burn tokens through the tokenManager\n     * @dev This function should revert if called by anyone but the service.\n     * @param tokenAddress_ The address of the token, since its cheaper to pass it in instead of reading it as the token manager.\n     * @param from The address to burn the token from.\n     * @param amount The amount to burn.\n     */\n    function burnToken(address tokenAddress_, address from, uint256 amount) external onlyService {\n        IERC20(tokenAddress_).safeCall(abi.encodeWithSelector(IERC20MintableBurnable.burn.selector, from, amount));\n    }\n}\n"
      },
      "contracts/utils/FlowLimit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { IFlowLimit } from '../interfaces/IFlowLimit.sol';\n\n/**\n * @title FlowLimit\n * @notice Implements flow limit logic for interchain token transfers.\n * @dev This contract implements low-level assembly for optimization purposes.\n */\ncontract FlowLimit is IFlowLimit {\n    // uint256(keccak256('flow-limit')) - 1\n    uint256 internal constant FLOW_LIMIT_SLOT = 0x201b7a0b7c19aaddc4ce9579b7df8d2db123805861bc7763627f13e04d8af42f;\n    uint256 internal constant PREFIX_FLOW_OUT_AMOUNT = uint256(keccak256('flow-out-amount'));\n    uint256 internal constant PREFIX_FLOW_IN_AMOUNT = uint256(keccak256('flow-in-amount'));\n\n    uint256 internal constant EPOCH_TIME = 6 hours;\n\n    /**\n     * @notice Returns the current flow limit.\n     * @return flowLimit_ The current flow limit value.\n     */\n    function flowLimit() public view returns (uint256 flowLimit_) {\n        assembly {\n            flowLimit_ := sload(FLOW_LIMIT_SLOT)\n        }\n    }\n\n    /**\n     * @notice Internal function to set the flow limit.\n     * @param flowLimit_ The value to set the flow limit to.\n     * @param tokenId The id of the token to set the flow limit for.\n     */\n    function _setFlowLimit(uint256 flowLimit_, bytes32 tokenId) internal {\n        assembly {\n            sstore(FLOW_LIMIT_SLOT, flowLimit_)\n        }\n\n        emit FlowLimitSet(tokenId, msg.sender, flowLimit_);\n    }\n\n    /**\n     * @notice Returns the slot which is used to get the flow out amount for a specific epoch.\n     * @param epoch The epoch to get the flow out amount for.\n     * @return slot The slot to get the flow out amount from.\n     */\n    function _getFlowOutSlot(uint256 epoch) internal pure returns (uint256 slot) {\n        slot = uint256(keccak256(abi.encode(PREFIX_FLOW_OUT_AMOUNT, epoch)));\n    }\n\n    /**\n     * @dev Returns the slot which is used to get the flow in amount for a specific epoch.\n     * @param epoch The epoch to get the flow in amount for.\n     * @return slot The slot to get the flow in amount from.\n     */\n    function _getFlowInSlot(uint256 epoch) internal pure returns (uint256 slot) {\n        slot = uint256(keccak256(abi.encode(PREFIX_FLOW_IN_AMOUNT, epoch)));\n    }\n\n    /**\n     * @notice Returns the current flow out amount.\n     * @return flowOutAmount_ The current flow out amount.\n     */\n    function flowOutAmount() external view returns (uint256 flowOutAmount_) {\n        uint256 epoch = block.timestamp / EPOCH_TIME;\n        uint256 slot = _getFlowOutSlot(epoch);\n\n        assembly {\n            flowOutAmount_ := sload(slot)\n        }\n    }\n\n    /**\n     * @notice Returns the current flow in amount.\n     * @return flowInAmount_ The current flow in amount.\n     */\n    function flowInAmount() external view returns (uint256 flowInAmount_) {\n        uint256 epoch = block.timestamp / EPOCH_TIME;\n        uint256 slot = _getFlowInSlot(epoch);\n\n        assembly {\n            flowInAmount_ := sload(slot)\n        }\n    }\n\n    /**\n     * @notice Adds a flow amount while ensuring it does not exceed the flow limit.\n     * @param flowLimit_ The current flow limit value.\n     * @param slotToAdd The slot to add the flow to.\n     * @param slotToCompare The slot to compare the flow against.\n     * @param flowAmount The flow amount to add.\n     */\n    function _addFlow(uint256 flowLimit_, uint256 slotToAdd, uint256 slotToCompare, uint256 flowAmount) internal {\n        uint256 flowToAdd;\n        uint256 flowToCompare;\n\n        assembly {\n            flowToAdd := sload(slotToAdd)\n            flowToCompare := sload(slotToCompare)\n        }\n\n        if (flowToAdd + flowAmount > flowToCompare + flowLimit_)\n            revert FlowLimitExceeded((flowToCompare + flowLimit_), flowToAdd + flowAmount, address(this));\n        if (flowAmount > flowLimit_) revert FlowLimitExceeded(flowLimit_, flowAmount, address(this));\n\n        assembly {\n            sstore(slotToAdd, add(flowToAdd, flowAmount))\n        }\n    }\n\n    /**\n     * @notice Adds a flow out amount.\n     * @param flowOutAmount_ The flow out amount to add.\n     */\n    function _addFlowOut(uint256 flowOutAmount_) internal {\n        uint256 flowLimit_ = flowLimit();\n        if (flowLimit_ == 0) return;\n\n        uint256 epoch = block.timestamp / EPOCH_TIME;\n        uint256 slotToAdd = _getFlowOutSlot(epoch);\n        uint256 slotToCompare = _getFlowInSlot(epoch);\n\n        _addFlow(flowLimit_, slotToAdd, slotToCompare, flowOutAmount_);\n    }\n\n    /**\n     * @notice Adds a flow in amount.\n     * @param flowInAmount_ The flow in amount to add.\n     */\n    function _addFlowIn(uint256 flowInAmount_) internal {\n        uint256 flowLimit_ = flowLimit();\n        if (flowLimit_ == 0) return;\n\n        uint256 epoch = block.timestamp / EPOCH_TIME;\n        uint256 slotToAdd = _getFlowInSlot(epoch);\n        uint256 slotToCompare = _getFlowOutSlot(epoch);\n\n        _addFlow(flowLimit_, slotToAdd, slotToCompare, flowInAmount_);\n    }\n}\n"
      },
      "contracts/utils/Operator.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport { RolesBase } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/RolesBase.sol';\n\nimport { IOperator } from '../interfaces/IOperator.sol';\n\nimport { RolesConstants } from './RolesConstants.sol';\n\n/**\n * @title Operator Contract\n * @notice A contract module which provides a basic access control mechanism, where\n * there is an account (a operator) that can be granted exclusive access to\n * specific functions.\n * @dev This module is used through inheritance.\n */\ncontract Operator is IOperator, RolesBase, RolesConstants {\n    /**\n     * @notice Internal function that stores the new operator address in the correct storage slot\n     * @param operator The address of the new operator\n     */\n    function _addOperator(address operator) internal {\n        _addRole(operator, uint8(Roles.OPERATOR));\n    }\n\n    /**\n     * @notice Change the operator of the contract.\n     * @dev Can only be called by the current operator.\n     * @param operator The address of the new operator.\n     */\n    function transferOperatorship(address operator) external onlyRole(uint8(Roles.OPERATOR)) {\n        _transferRole(msg.sender, operator, uint8(Roles.OPERATOR));\n    }\n\n    /**\n     * @notice Propose a change of the operator of the contract.\n     * @dev Can only be called by the current operator.\n     * @param operator The address of the new operator.\n     */\n    function proposeOperatorship(address operator) external onlyRole(uint8(Roles.OPERATOR)) {\n        _proposeRole(msg.sender, operator, uint8(Roles.OPERATOR));\n    }\n\n    /**\n     * @notice Accept a proposed change of operatorship.\n     * @dev Can only be called by the proposed operator.\n     * @param fromOperator The previous operator of the contract.\n     */\n    function acceptOperatorship(address fromOperator) external {\n        _acceptRole(fromOperator, msg.sender, uint8(Roles.OPERATOR));\n    }\n\n    /**\n     * @notice Query if an address is a operator.\n     * @param addr The address to query for.\n     * @return bool Boolean value representing whether or not the address is an operator.\n     */\n    function isOperator(address addr) external view returns (bool) {\n        return hasRole(addr, uint8(Roles.OPERATOR));\n    }\n}\n"
      },
      "contracts/utils/RolesConstants.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title RolesConstants\n * @notice This contract contains enum values representing different contract roles.\n */\ncontract RolesConstants {\n    enum Roles {\n        MINTER,\n        OPERATOR,\n        FLOW_LIMITER\n    }\n}\n"
      }
    },
    "settings": {
      "evmVersion": "london",
      "optimizer": {
        "enabled": true,
        "runs": 1000,
        "details": {
          "peephole": true,
          "inliner": true,
          "jumpdestRemover": true,
          "orderLiterals": true,
          "deduplicate": true,
          "cse": true,
          "constantOptimizer": true,
          "yul": true,
          "yulDetails": {
            "stackAllocation": true
          }
        }
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}