// After hitting a reset error, it reset derivation, and drops the old L1 chain
// After hitting a reset error, it resets derivation, and drops the old L1 chain
sequencer.ActL2PipelineFull(t)
require.Zero(t,sequencer.SyncStatus().UnsafeL2.L1Origin.Number,"back to genesis block with good L1 origin, drop old unsafe L2 chain with bad L1 origins")
// Can build new L2 blocks with good L1 origin
sequencer.ActBuildToL1HeadUnsafe(t)
require.Equal(t,newStatus.HeadL1.Hash,sequencer.SyncStatus().UnsafeL2.L1Origin.Hash,"build L2 chain with new correct L1 origins")
require.Equal(t,refB1,eq.SafeL2Head(),"L2 reset should go back to sequence window ago: blocks with origin E and D are not safe until we reconcile, C is extra, and B1 is the end we look for")
require.Equal(t,refB,eq.Origin(),"Expecting to be set back derivation L1 progress to B")
require.Equal(t,refA1,eq.Finalized(),"A1 is recognized as finalized before we run any steps")
// First step after reset will do a fork choice update
require.Equal(t,refB1,eq.SafeL2Head(),"L2 reset should go back to sequence window ago: blocks with origin E and D are not safe until we reconcile, C is extra, and B1 is the end we look for")
require.Equal(t,refB,eq.Origin(),"Expecting to be set back derivation L1 progress to B")
require.Equal(t,refA1,eq.Finalized(),"A1 is recognized as finalized before we run any steps")
// First step after reset will do a fork choice update
// 0x33 = 51. L1CrossDomainMessenger is L1CrossDomainMessenger (0) Lib_AddressResolver (1) OwnableUpgradeable (1, but covered by gap) + ContextUpgradeable (special gap of 50) and then _owner
If reading more than one attestation you can use readAttestations to read them with multicall
If reading more than one attestation you can use [`readAttestations`](#readattestations) to read them with [multicall](https://www.npmjs.com/package/ethereum-multicall).
### Writing an attestation
To write to an attestation you must [connect](https://wagmi.sh/core/connectors/metaMask) your wagmi client if not already connected. If using Node.js use the [mock connector](https://wagmi.sh/core/connectors/mock)
To write to an attestation you must [connect](https://wagmi.sh/core/connectors/metaMask) your wagmi client if not already connected.
If using Node.js use the [mock connector](https://wagmi.sh/core/connectors/mock).
The deterministic deployment address for the attestation station currently deployed with create2 on Optimism and Optimism Goerli `0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77`
### High level API
These functions are the easiest way to interact with the AttestationStation contract.
For a more detailed explanation, [see the tutorial](https://github.com/ethereum-optimism/optimism-tutorial/tree/main/ecosystem/attestation-station/using-sdk).
#### `getEvents`
Use `getEvents` to get attestation events using a provider and filters.
**Return Value:** A list of values attested by the `creator` on the `about` address concerning the `key`, when interpreted as the `dataType`.
These utilities for parsing bytes are provided:
`parseAddress`
`parseNumber`
`parseBool`
`parseString`
#### `writeAttestation`
Note: `readAttestation` and `readAttestations` already parse the bytes so this is only necessary if reading attestations directly from chain instead of through this utility
[Writes the prepared tx](https://wagmi.sh/core/actions/writeContract).
```typescript
constattestation=parseAttestationBytes(
/**
* HexString: The raw bytes returned from reading an attestation
These definitions allow you to communicate with AttestationStation, but are not as easy to use as the high level API.
#### `ATTESTATION_STATION_ADDRESS`
The deployment address for the attestation station currently deployed with create2 on Optimism and Optimism Goerli `0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77`.
For react hooks we recomend using the [wagmi cli](https://wagmi.sh/cli/getting-started) with the [etherscan plugin](https://wagmi.sh/cli/plugins/etherscan) and [react plugin](https://wagmi.sh/cli/plugins/react) to automatically generate react hooks around the attestation station.
### getEvents
Use `createKey` and `createValue` to convert your raw keys and values into bytes that can be used in the attestation station contract calls.
Use `parseString`, `parseBool`, `parseAddress` and `parseNumber` to convert values returned by attestation station to their correct data type.
To getEvents use getEvents with a provider and any filters to filter the event
For convenience we also [export the hooks](../src/react.ts) here:
-`useAttestationStationAttestation` - Reads attestations with useContractRead
-`useAttestationStationVersion` - Reads attestation version
-`useAttestationStationAttest` - Wraps useContractWrite with attestation station abi calling attest
-`usePrepareAttestationStationAttest` - Wraps usePrepare with attestation station abi calling attest
-`useAttestationStationAttestationCreatedEvent` - Wraps useContractEvents for Created events
Set key, about, creator, or value to `null` to not include that filter
## Tutorial
For a tutorial on using the attestation station in general, see out tutorial as well as other Optimism related tutorials in our [optimism-tutorial](https://github.com/ethereum-optimism/optimism-tutorial/tree/main/ecosystem/attestation-station#key-values) repo
For a tutorial on using the attestation station in general, see out tutorial as well as other Optimism related tutorials in our [optimism-tutorial](https://github.com/ethereum-optimism/optimism-tutorial/tree/main/ecosystem/attestation-station#key-values) repo.
If there is not enough gas in the callframe to ensure that `callWithMinGas` can provide the specified minimum gas limit to the subcontext of the call, then `callWithMinGas` must revert.
> TeleportrDeposit Shout out to 0xclem for providing the inspiration for this contract: https://github.com/0xclem/teleportr/blob/main/contracts/BridgeDeposit.sol
## Methods
### maxBalance
```solidity
function maxBalance() external view returns (uint256)
```
The maximum balance the contract can hold after a receive.
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
### maxDepositAmount
```solidity
function maxDepositAmount() external view returns (uint256)
```
The maximum amount that be deposited in a receive.
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
### minDepositAmount
```solidity
function minDepositAmount() external view returns (uint256)
```
The minimum amount that be deposited in a receive.
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
### owner
```solidity
function owner() external view returns (address)
```
*Returns the address of the current owner.*
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined
### renounceOwnership
```solidity
function renounceOwnership() external nonpayable
```
*Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.*
### setMaxAmount
```solidity
function setMaxAmount(uint256 _maxDepositAmount) external nonpayable
```
Sets the maximum amount that can be deposited in a receive.
#### Parameters
| Name | Type | Description |
|---|---|---|
| _maxDepositAmount | uint256 | The new maximum deposit amount.
### setMaxBalance
```solidity
function setMaxBalance(uint256 _maxBalance) external nonpayable
```
Sets the maximum balance the contract can hold after a receive.
#### Parameters
| Name | Type | Description |
|---|---|---|
| _maxBalance | uint256 | The new maximum contract balance.
### setMinAmount
```solidity
function setMinAmount(uint256 _minDepositAmount) external nonpayable
```
Sets the minimum amount that can be deposited in a receive.
#### Parameters
| Name | Type | Description |
|---|---|---|
| _minDepositAmount | uint256 | The new minimum deposit amount.
### totalDeposits
```solidity
function totalDeposits() external view returns (uint256)
```
The total number of successful deposits received.
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
### transferOwnership
```solidity
function transferOwnership(address newOwner) external nonpayable
```
*Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.*
#### Parameters
| Name | Type | Description |
|---|---|---|
| newOwner | address | undefined
### withdrawBalance
```solidity
function withdrawBalance() external nonpayable
```
Sends the contract's current balance to the owner.
function disburse(uint256 _nextDepositId, TeleportrDisburser.Disbursement[] _disbursements) external payable
```
Accepts a list of Disbursements and forwards the amount paid to the contract to each recipient. The method reverts if there are zero disbursements, the total amount to forward differs from the amount sent in the transaction, or the _nextDepositId is unexpected. Failed disbursements will not cause the method to revert, but will instead be held by the contract and availabe for the owner to withdraw.
#### Parameters
| Name | Type | Description |
|---|---|---|
| _nextDepositId | uint256 | The depositId of the first Dispursement.
| _disbursements | TeleportrDisburser.Disbursement[] | A list of Disbursements to process.
### owner
```solidity
function owner() external view returns (address)
```
*Returns the address of the current owner.*
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined
### renounceOwnership
```solidity
function renounceOwnership() external nonpayable
```
*Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.*
### totalDisbursements
```solidity
function totalDisbursements() external view returns (uint256)
```
The total number of disbursements processed.
#### Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
### transferOwnership
```solidity
function transferOwnership(address newOwner) external nonpayable
```
*Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.*
#### Parameters
| Name | Type | Description |
|---|---|---|
| newOwner | address | undefined
### withdrawBalance
```solidity
function withdrawBalance() external nonpayable
```
Sends the contract's current balance to the owner.