# Authorization

The user should grant authorization to allow smart contracts (including precompiled ones) to send messages on behalf of a user account. This is achieved by the `Authorization.sol` and `GenericAuthorization.sol` that provide the necessary functions to grant approvals and allowances. The precompiled contracts use these interfaces, `AuthorizationI` and `GenericAuthorizationI`, to allow users to approve the corresponding messages and amounts if needed.

### Solidity Interfaces[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#solidity-interfaces) <a href="#solidity-interfaces" id="solidity-interfaces"></a>

#### `Authorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#authorizationsol) <a href="#authorizationsol" id="authorizationsol"></a>

Find the [Solidity interface in the evmos/extensions repo](https://github.com/evmos/extensions/blob/main/precompiles/common/Authorization.sol).

#### `GenericAuthorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#genericauthorizationsol) <a href="#genericauthorizationsol" id="genericauthorizationsol"></a>

Find the [Solidity interface in the evmos/extensions repo](https://github.com/evmos/extensions/blob/main/precompiles/common/GenericAuthorization.sol).

### Transactions[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#transactions) <a href="#transactions" id="transactions"></a>

#### `Authorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#authorizationsol-1) <a href="#authorizationsol-1" id="authorizationsol-1"></a>

* `approve`

  Approves a list of Cosmos or IBC transactions with a specific amount of tokens

  ```
  function approve(
          address spender,
          uint256 amount,
          string[] calldata methods
      ) external returns (bool approved);
  ```
* `increaseAllowance`

  Increase the allowance of a given spender by a specific amount of tokens for IBC transfer methods or staking

  ```
  function increaseAllowance(
          address spender,
          uint256 amount,
          string[] calldata methods
      ) external returns (bool approved);
  ```
* `decreaseAllowance`

  Decreases the allowance of a given spender by a specific amount of tokens for IBC transfer methods or staking

  ```
  function decreaseAllowance(
          address spender,
          uint256 amount,
          string[] calldata methods
      ) external returns (bool approved);
  ```

#### `GenericAuthorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#genericauthorizationsol-1) <a href="#genericauthorizationsol-1" id="genericauthorizationsol-1"></a>

* `approve`

  Approves a list of Cosmos message

  ```
  function approve(
          address spender,
          string[] calldata methods
      ) external returns (bool approved);
  ```

### Queries[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#queries) <a href="#queries" id="queries"></a>

#### `Authorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#authorizationsol-2) <a href="#authorizationsol-2" id="authorizationsol-2"></a>

* `allowance`

  Returns the remaining number of tokens that the spender will be allowed to spend on behalf of the owner through IBC transfer methods or staking. This is zero by default

  ```
  function allowance(
          address owner,
          address spender,
          string calldata method
  ) external view returns (uint256 remaining);
  ```

### Events[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#events) <a href="#events" id="events"></a>

#### `Authorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#authorizationsol-3) <a href="#authorizationsol-3" id="authorizationsol-3"></a>

* `Approval`

  This event is emitted when the allowance of a spender is set by a call to the `approve` method. The `value` field specifies the new allowance and the `methods` field holds the information for which methods the approval was set.

  ```
  event Approval(
          address indexed owner,
          address indexed spender,
          string[] methods,
          uint256 value
      );
  ```
* `AllowanceChange`

  This event is emitted when the allowance of a spender is changed by a call to the decrease or increase allowance method. The `values` field specifies the new allowances and the `methods` field holds the information for which methods the approval was set.

  ```
  event AllowanceChange(
          address indexed owner,
          address indexed spender,
          string[] methods,
          uint256[] values
      );
  ```

#### `GenericAuthorization.sol`[​](https://docs.evmos.org/develop/smart-contracts/evm-extensions/authorization#genericauthorizationsol-2) <a href="#genericauthorizationsol-2" id="genericauthorizationsol-2"></a>

* `Approval`

  This event is emitted when the allowance of a spender is set by a call to the `approve` method. The `methods` field holds the information for which methods the approval was set.

  ```
  event Approval(
          address indexed owner,
          address indexed spender,
          string[] methods
      );
  ```
