# Pair (ERC 20)

This documentation covers ERC-20 functionality for denominating pool tokens. For JediSwap-specific functionality, see [Pair](/for-developers/jediswap-v1/smart-contract-reference/pair.md).

## Code

[Pair.cairo](https://github.com/jediswaplabs/jediswap/blob/main/contracts/pair.cairo)

## Events

### Approval​

```js
@event
func Approval(owner: felt, spender: felt, amount: Uint256):
end
```

Emitted each time allowances is updated in [approve](#approve), [increaseAllowance](#increaseallowance), [decreaseAllowance](#decreaseallowance) or [transferFrom](#transferfrom)

### Transfer​

```js
@event
func Transfer(from_address: felt, to_address: felt, amount: Uint256):
end
```

Emitted each time a transfer occurs via [transfer](#transfer-1), [transferFrom](#transferfrom), [mint](/for-developers/jediswap-v1/smart-contract-reference/pair.md#mint-1), or [burn](/for-developers/jediswap-v1/smart-contract-reference/pair.md#burn-1).

## View Functions

### name​

```js
func name() -> (name: felt):
```

Returns JediSwap Pair for all pairs.

### symbol​

```js
func symbol() -> (symbol: felt):
```

Returns JEDIP for all pairs.

### decimals​

```js
func decimals() -> (decimals: felt):
```

Returns 18 for all pairs.

### totalSupply​

```js
func totalSupply() -> (totalSupply: Uint256):
```

Returns the total amount of pool tokens for a pair.

### balanceOf​

```js
func balanceOf(account: felt) -> (balance: Uint256):
```

Returns the amount of pool tokens owned by an address.

### allowance​

```js
func allowance(owner: felt, spender: felt) -> (remaining: Uint256):
```

Returns the amount of liquidity tokens owned by an address that a spender is allowed to transfer via transferFrom.

## State-Changing Functions

### approve​

```js
func approve(spender: felt, amount: Uint256) -> (success: felt):
```

Lets *caller* set their allowance for a spender.

* Emits [Approval](#approval).

### increaseAllowance​

```js
func increaseAllowance(spender: felt, added_value: Uint256) -> (success: felt):
```

Lets *caller* increase their allowance for a spender by added\_value.

* Emits [Approval](#approval).

### decreaseAllowance​

```js
func decreaseAllowance(spender: felt, subtracted_value: Uint256) -> (success: felt):
```

Lets *caller* decrease their allowance for a spender by subtracted\_value.

* Emits [Approval](#approval).

### transfer​

```js
func transfer(recipient: felt, amount: Uint256) -> (success: felt):
```

Lets *caller* send pool tokens to an address.

* Emits [Transfer](#transfer).

### transferFrom​

```js
func transferFrom(
            sender: felt, 
            recipient: felt, 
            amount: Uint256
        ) -> (success: felt):
```

Sends pool tokens from one address to another.

* Requires approval.
* Emits [Transfer](#transfer)

## Interface

```js
%lang starknet

from starkware.cairo.common.uint256 import Uint256

@contract_interface
namespace IJediSwapPairERC20:
    func name() -> (name: felt):
    end

    func symbol() -> (symbol: felt):
    end

    func decimals() -> (decimals: felt):
    end

    func totalSupply() -> (totalSupply: Uint256):
    end

    func balanceOf(account: felt) -> (balance: Uint256):
    end

    func allowance(owner: felt, spender: felt) -> (remaining: Uint256):
    end

    func transfer(recipient: felt, amount: Uint256) -> (success: felt):
    end

    func transferFrom(
            sender: felt, 
            recipient: felt, 
            amount: Uint256
        ) -> (success: felt):
    end

    func approve(spender: felt, amount: Uint256) -> (success: felt):
    end

    func increaseAllowance(spender: felt, added_value: Uint256) -> (success: felt):
    end

    func decreaseAllowance(spender: felt, subtracted_value: Uint256) -> (success: felt):
    end
end


```

## ABI

See [Pair ABI](/for-developers/jediswap-v1/smart-contract-reference/pair.md#abi)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jediswap.xyz/for-developers/jediswap-v1/smart-contract-reference/pair-erc-20.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
