> For the complete documentation index, see [llms.txt](https://the-artist-xchange.gitbook.io/the-artist-xchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://the-artist-xchange.gitbook.io/the-artist-xchange/docs/ientrypoint.md).

# IEntryPoint

## Methods

### addStake

```solidity
function addStake(uint32 _unstakeDelaySec) external payable
```

add to the account's stake - amount and delay any pending unstake is first cancelled.

#### Parameters

| Name              | Type   | Description                                                |
| ----------------- | ------ | ---------------------------------------------------------- |
| \_unstakeDelaySec | uint32 | the new lock duration before the deposit can be withdrawn. |

### balanceOf

```solidity
function balanceOf(address account) external view returns (uint256)
```

#### Parameters

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| account | address | undefined   |

#### Returns

| Name | Type    | Description                                  |
| ---- | ------- | -------------------------------------------- |
| \_0  | uint256 | the deposit (for gas payment) of the account |

### depositTo

```solidity
function depositTo(address account) external payable
```

add to the deposit of the given account

#### Parameters

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| account | address | undefined   |

### getDepositInfo

```solidity
function getDepositInfo(address account) external view returns (struct IStakeManager.DepositInfo info)
```

#### Parameters

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| account | address | undefined   |

#### Returns

| Name | Type                      | Description                                 |
| ---- | ------------------------- | ------------------------------------------- |
| info | IStakeManager.DepositInfo | - full deposit information of given account |

### getSenderAddress

```solidity
function getSenderAddress(bytes initCode) external nonpayable
```

Get counterfactual sender address. Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation. this method always revert, and returns the address in SenderAddressResult error

#### Parameters

| Name     | Type  | Description                                               |
| -------- | ----- | --------------------------------------------------------- |
| initCode | bytes | the constructor code to be passed into the UserOperation. |

### getUserOpHash

```solidity
function getUserOpHash(UserOperation userOp) external view returns (bytes32)
```

#### Parameters

| Name   | Type          | Description |
| ------ | ------------- | ----------- |
| userOp | UserOperation | undefined   |

#### Returns

| Name | Type    | Description |
| ---- | ------- | ----------- |
| \_0  | bytes32 | undefined   |

### handleAggregatedOps

```solidity
function handleAggregatedOps(IEntryPoint.UserOpsPerAggregator[] opsPerAggregator, address payable beneficiary) external nonpayable
```

#### Parameters

| Name             | Type                                | Description |
| ---------------- | ----------------------------------- | ----------- |
| opsPerAggregator | IEntryPoint.UserOpsPerAggregator\[] | undefined   |
| beneficiary      | address payable                     | undefined   |

### handleOps

```solidity
function handleOps(UserOperation[] ops, address payable beneficiary) external nonpayable
```

#### Parameters

| Name        | Type             | Description |
| ----------- | ---------------- | ----------- |
| ops         | UserOperation\[] | undefined   |
| beneficiary | address payable  | undefined   |

### simulateHandleOp

```solidity
function simulateHandleOp(UserOperation op, address target, bytes targetCallData) external nonpayable
```

#### Parameters

| Name           | Type          | Description |
| -------------- | ------------- | ----------- |
| op             | UserOperation | undefined   |
| target         | address       | undefined   |
| targetCallData | bytes         | undefined   |

### simulateValidation

```solidity
function simulateValidation(UserOperation userOp) external nonpayable
```

#### Parameters

| Name   | Type          | Description |
| ------ | ------------- | ----------- |
| userOp | UserOperation | undefined   |

### unlockStake

```solidity
function unlockStake() external nonpayable
```

attempt to unlock the stake. the value can be withdrawn (using withdrawStake) after the unstake delay.

### withdrawStake

```solidity
function withdrawStake(address payable withdrawAddress) external nonpayable
```

withdraw from the (unlocked) stake. must first call unlockStake and wait for the unstakeDelay to pass

#### Parameters

| Name            | Type            | Description                          |
| --------------- | --------------- | ------------------------------------ |
| withdrawAddress | address payable | the address to send withdrawn value. |

### withdrawTo

```solidity
function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external nonpayable
```

withdraw from the deposit.

#### Parameters

| Name            | Type            | Description                          |
| --------------- | --------------- | ------------------------------------ |
| withdrawAddress | address payable | the address to send withdrawn value. |
| withdrawAmount  | uint256         | the amount to withdraw.              |

## Events

### AccountDeployed

```solidity
event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster)
```

account "sender" was deployed.

#### Parameters

| Name                 | Type    | Description                                                            |
| -------------------- | ------- | ---------------------------------------------------------------------- |
| userOpHash `indexed` | bytes32 | the userOp that deployed this account. UserOperationEvent will follow. |
| sender `indexed`     | address | the account that is deployed                                           |
| factory              | address | the factory used to deploy this account (in the initCode)              |
| paymaster            | address | the paymaster used by this UserOp                                      |

### Deposited

```solidity
event Deposited(address indexed account, uint256 totalDeposit)
```

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| account `indexed` | address | undefined   |
| totalDeposit      | uint256 | undefined   |

### SignatureAggregatorChanged

```solidity
event SignatureAggregatorChanged(address indexed aggregator)
```

signature aggregator used by the following UserOperationEvents within this bundle.

#### Parameters

| Name                 | Type    | Description |
| -------------------- | ------- | ----------- |
| aggregator `indexed` | address | undefined   |

### StakeLocked

```solidity
event StakeLocked(address indexed account, uint256 totalStaked, uint256 unstakeDelaySec)
```

Emitted when stake or unstake delay are modified

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| account `indexed` | address | undefined   |
| totalStaked       | uint256 | undefined   |
| unstakeDelaySec   | uint256 | undefined   |

### StakeUnlocked

```solidity
event StakeUnlocked(address indexed account, uint256 withdrawTime)
```

Emitted once a stake is scheduled for withdrawal

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| account `indexed` | address | undefined   |
| withdrawTime      | uint256 | undefined   |

### StakeWithdrawn

```solidity
event StakeWithdrawn(address indexed account, address withdrawAddress, uint256 amount)
```

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| account `indexed` | address | undefined   |
| withdrawAddress   | address | undefined   |
| amount            | uint256 | undefined   |

### UserOperationEvent

```solidity
event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)
```

#### Parameters

| Name                 | Type    | Description |
| -------------------- | ------- | ----------- |
| userOpHash `indexed` | bytes32 | undefined   |
| sender `indexed`     | address | undefined   |
| paymaster `indexed`  | address | undefined   |
| nonce                | uint256 | undefined   |
| success              | bool    | undefined   |
| actualGasCost        | uint256 | undefined   |
| actualGasUsed        | uint256 | undefined   |

### UserOperationRevertReason

```solidity
event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)
```

An event emitted if the UserOperation "callData" reverted with non-zero length

#### Parameters

| Name                 | Type    | Description                                                |
| -------------------- | ------- | ---------------------------------------------------------- |
| userOpHash `indexed` | bytes32 | the request unique identifier.                             |
| sender `indexed`     | address | the sender of this request                                 |
| nonce                | uint256 | the nonce used in the request                              |
| revertReason         | bytes   | - the return bytes from the (reverted) call to "callData". |

### Withdrawn

```solidity
event Withdrawn(address indexed account, address withdrawAddress, uint256 amount)
```

#### Parameters

| Name              | Type    | Description |
| ----------------- | ------- | ----------- |
| account `indexed` | address | undefined   |
| withdrawAddress   | address | undefined   |
| amount            | uint256 | undefined   |

## Errors

### ExecutionResult

```solidity
error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult)
```

return value of simulateHandleOp

#### Parameters

| Name          | Type    | Description |
| ------------- | ------- | ----------- |
| preOpGas      | uint256 | undefined   |
| paid          | uint256 | undefined   |
| validAfter    | uint48  | undefined   |
| validUntil    | uint48  | undefined   |
| targetSuccess | bool    | undefined   |
| targetResult  | bytes   | undefined   |

### FailedOp

```solidity
error FailedOp(uint256 opIndex, string reason)
```

a custom revert error of handleOps, to identify the offending op. NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.

#### Parameters

| Name    | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                 |
| ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| opIndex | uint256 | - index into the array of ops to the failed one (in simulateValidation, this is always zero)                                                                                                                                                                                                                                                                                                |
| reason  | string  | - revert reason The string starts with a unique code "AAmn", where "m" is "1" for factory, "2" for account and "3" for paymaster issues, so a failure can be attributed to the correct entity. Should be caught in off-chain handleOps simulation and not happen on-chain. Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts. |

### SenderAddressResult

```solidity
error SenderAddressResult(address sender)
```

return value of getSenderAddress

#### Parameters

| Name   | Type    | Description |
| ------ | ------- | ----------- |
| sender | address | undefined   |

### SignatureValidationFailed

```solidity
error SignatureValidationFailed(address aggregator)
```

error case when a signature aggregator fails to verify the aggregated signature it had created.

#### Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| aggregator | address | undefined   |

### ValidationResult

```solidity
error ValidationResult(IEntryPoint.ReturnInfo returnInfo, IStakeManager.StakeInfo senderInfo, IStakeManager.StakeInfo factoryInfo, IStakeManager.StakeInfo paymasterInfo)
```

Successful result from simulateValidation.

#### Parameters

| Name          | Type                    | Description                                    |
| ------------- | ----------------------- | ---------------------------------------------- |
| returnInfo    | IEntryPoint.ReturnInfo  | gas and time-range returned values             |
| senderInfo    | IStakeManager.StakeInfo | stake information about the sender             |
| factoryInfo   | IStakeManager.StakeInfo | stake information about the factory (if any)   |
| paymasterInfo | IStakeManager.StakeInfo | stake information about the paymaster (if any) |

### ValidationResultWithAggregation

```solidity
error ValidationResultWithAggregation(IEntryPoint.ReturnInfo returnInfo, IStakeManager.StakeInfo senderInfo, IStakeManager.StakeInfo factoryInfo, IStakeManager.StakeInfo paymasterInfo, IEntryPoint.AggregatorStakeInfo aggregatorInfo)
```

Successful result from simulateValidation, if the account returns a signature aggregator

#### Parameters

| Name           | Type                            | Description                                                                                                                                        |
| -------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| returnInfo     | IEntryPoint.ReturnInfo          | gas and time-range returned values                                                                                                                 |
| senderInfo     | IStakeManager.StakeInfo         | stake information about the sender                                                                                                                 |
| factoryInfo    | IStakeManager.StakeInfo         | stake information about the factory (if any)                                                                                                       |
| paymasterInfo  | IStakeManager.StakeInfo         | stake information about the paymaster (if any)                                                                                                     |
| aggregatorInfo | IEntryPoint.AggregatorStakeInfo | signature aggregation info (if the account requires signature aggregator) bundler MUST use it to verify the signature, or reject the UserOperation |
