> For the complete documentation index, see [llms.txt](https://docs.algebra.finance/algebra-integral-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.algebra.finance/algebra-integral-documentation/algebra-v1-technical-reference/contracts/api-reference-v1.0/v1.0-periphery/iselfpermit.md).

# ISelfPermit

## ISelfPermit

Self Permit Functionality to call permit on any EIP-2612-compliant token for use in the route

### Functions

#### selfPermit

`selfPermit(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend a given token from \`msg.sender\`

| Name     | Type    | Description                                                                       |
| -------- | ------- | --------------------------------------------------------------------------------- |
| token    | address | The address of the token spent                                                    |
| value    | uint256 | The amount that can be spent of token                                             |
| deadline | uint256 | A timestamp, the current blocktime must be less than or equal to this timestamp   |
| v        | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

#### selfPermitIfNecessary

`selfPermitIfNecessary(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend a given token from \`msg.sender\`

| Name     | Type    | Description                                                                       |
| -------- | ------- | --------------------------------------------------------------------------------- |
| token    | address | The address of the token spent                                                    |
| value    | uint256 | The amount that can be spent of token                                             |
| deadline | uint256 | A timestamp, the current blocktime must be less than or equal to this timestamp   |
| v        | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

#### selfPermitAllowed

`selfPermitAllowed(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend the sender's tokens for permit signatures that have the \`allowed\` parameter

| Name   | Type    | Description                                                                       |
| ------ | ------- | --------------------------------------------------------------------------------- |
| token  | address | The address of the token spent                                                    |
| nonce  | uint256 | The current nonce of the owner                                                    |
| expiry | uint256 | The timestamp at which the permit is no longer valid                              |
| v      | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

#### selfPermitAllowedIfNecessary

`selfPermitAllowedIfNecessary(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend the sender's tokens for permit signatures that have the \`allowed\` parameter

| Name   | Type    | Description                                                                       |
| ------ | ------- | --------------------------------------------------------------------------------- |
| token  | address | The address of the token spent                                                    |
| nonce  | uint256 | The current nonce of the owner                                                    |
| expiry | uint256 | The timestamp at which the permit is no longer valid                              |
| v      | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

***

## ISelfPermit

Self Permit Functionality to call permit on any EIP-2612-compliant token for use in the route

### Functions

#### selfPermit

`selfPermit(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend a given token from \`msg.sender\`

| Name     | Type    | Description                                                                       |
| -------- | ------- | --------------------------------------------------------------------------------- |
| token    | address | The address of the token spent                                                    |
| value    | uint256 | The amount that can be spent of token                                             |
| deadline | uint256 | A timestamp, the current blocktime must be less than or equal to this timestamp   |
| v        | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

#### selfPermitIfNecessary

`selfPermitIfNecessary(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend a given token from \`msg.sender\`

| Name     | Type    | Description                                                                       |
| -------- | ------- | --------------------------------------------------------------------------------- |
| token    | address | The address of the token spent                                                    |
| value    | uint256 | The amount that can be spent of token                                             |
| deadline | uint256 | A timestamp, the current blocktime must be less than or equal to this timestamp   |
| v        | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s        | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

#### selfPermitAllowed

`selfPermitAllowed(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend the sender's tokens for permit signatures that have the \`allowed\` parameter

| Name   | Type    | Description                                                                       |
| ------ | ------- | --------------------------------------------------------------------------------- |
| token  | address | The address of the token spent                                                    |
| nonce  | uint256 | The current nonce of the owner                                                    |
| expiry | uint256 | The timestamp at which the permit is no longer valid                              |
| v      | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

#### selfPermitAllowedIfNecessary

`selfPermitAllowedIfNecessary(address,uint256,uint256,uint8,bytes32,bytes32)` payable external

Permits this contract to spend the sender's tokens for permit signatures that have the \`allowed\` parameter

| Name   | Type    | Description                                                                       |
| ------ | ------- | --------------------------------------------------------------------------------- |
| token  | address | The address of the token spent                                                    |
| nonce  | uint256 | The current nonce of the owner                                                    |
| expiry | uint256 | The timestamp at which the permit is no longer valid                              |
| v      | uint8   | Must produce valid secp256k1 signature from the holder along with \`r\` and \`s\` |
| r      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`v\` and \`s\` |
| s      | bytes32 | Must produce valid secp256k1 signature from the holder along with \`r\` and \`v\` |

***
