> ## Documentation Index
> Fetch the complete documentation index at: https://injectivelabs-docs-ai-sdk.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 상태

# 상태

이 문서는 Peggy 모듈이 KV 쌍으로 상태에 읽기/쓰기하는 모든 데이터를 나열합니다

### 모듈 파라미터

Params는 파라미터를 저장하고 peggy 모듈의 전반적인 기능을 정의하는 모듈 전체 구성 구조입니다. 각 파라미터에 대한 자세한 사양은 [파라미터 섹션](./08_params)에서 찾을 수 있습니다.

| key           | Value         | Type           | Encoding         |
| ------------- | ------------- | -------------- | ---------------- |
| `[]byte{0x4}` | Module params | `types.Params` | Protobuf encoded |

### 검증자 정보

#### 검증자별 Ethereum 주소

`Validator`의 계정 주소로 인덱싱된 `Delegate Ethereum address` 저장

| key                                   | Value            | Type             | Encoding         |
| ------------------------------------- | ---------------- | ---------------- | ---------------- |
| `[]byte{0x1} + []byte(validatorAddr)` | Ethereum address | `common.Address` | Protobuf encoded |

#### Ethereum 주소별 검증자

`Delegate Ethereum address`로 인덱싱된 `Validator` 계정 주소 저장

| key                                 | Value             | Type             | Encoding         |
| ----------------------------------- | ----------------- | ---------------- | ---------------- |
| `[]byte{0xfb} + []byte(ethAddress)` | Validator address | `sdk.ValAddress` | Protobuf encoded |

#### OrchestratorValidator

검증자가 투표 권한을 다른 키에 위임하려는 경우. 값은 orchestrator 주소를 키로 사용하여 저장됩니다

| Key                                 | Value                                        | Type     | Encoding         |
| ----------------------------------- | -------------------------------------------- | -------- | ---------------- |
| `[]byte{0xe8} + []byte(AccAddress)` | Orchestrator address assigned by a validator | `[]byte` | Protobuf encoded |

### Valset

브릿지의 검증자 세트입니다. EndBlocker 동안 `Peggy module`에 의해 자동으로 생성됩니다.

두 가지 방법으로 저장됩니다. 첫 번째는 높이와 함께, 두 번째는 높이 없이(unsafe). Unsafe는 테스트 및 상태 내보내기/가져오기에 사용됩니다.

```go theme={null}
type Valset struct {
	Nonce        uint64                               
	Members      []*BridgeValidator                   
	Height       uint64                               
	RewardAmount math.Int 
	RewardToken string
}

```

| key                                        | Value         | Type           | Encoding         |
| ------------------------------------------ | ------------- | -------------- | ---------------- |
| `[]byte{0x2} + nonce (big endian encoded)` | Validator set | `types.Valset` | Protobuf encoded |

### SlashedValsetNonce

최신 검증자 세트 슬래시 nonce. 어떤 검증자 세트가 슬래싱이 필요하고 이미 슬래싱되었는지 추적하는 데 사용됩니다.

| Key            | Value | Type   | Encoding               |
| -------------- | ----- | ------ | ---------------------- |
| `[]byte{0xf5}` | Nonce | uint64 | encoded via big endian |

### ValsetNonce

최신 검증자 세트의 Nonce. 각 새 검증자 세트에서 업데이트됩니다.

| key            | Value | Type     | Encoding               |
| -------------- | ----- | -------- | ---------------------- |
| `[]byte{0xf6}` | Nonce | `uint64` | encoded via big endian |

### Valset 확인

특정 검증자 세트에 대한 `Singer` 확인. [oracle 메시지](./04_messages.md#ValsetConfirm) 참조

| Key                                         | Value                  | Type                     | Encoding         |
| ------------------------------------------- | ---------------------- | ------------------------ | ---------------- |
| `[]byte{0x3} + (nonce + []byte(AccAddress)` | Validator Confirmation | `types.MsgValsetConfirm` | Protobuf encoded |

### Batch 확인

특정 토큰 배치에 대한 `Singer` 확인. [oracle 메시지](./04_messages.md#ConfirmBatch) 참조

| Key                                                                 | Value                        | Type                    | Encoding         |
| ------------------------------------------------------------------- | ---------------------------- | ----------------------- | ---------------- |
| `[]byte{0xe1} + []byte(tokenContract) + nonce + []byte(AccAddress)` | Validator Batch Confirmation | `types.MsgConfirmBatch` | Protobuf encoded |

### OutgoingTransferTx

사용자 출금은 나중에 `Batch Creator`에 의해 배치되기 위해 `Peggy Tx Pool`에 함께 풀링됩니다.

각 출금은 출금이 수신될 때 `Peggy module`에 의해 설정된 고유한 nonce로 인덱싱됩니다.

```go theme={null}
type OutgoingTransferTx struct {
	Id          uint64     
	Sender      string     
	DestAddress string     
	Erc20Token  *ERC20Token 
	Erc20Fee    *ERC20Token 
}
```

| Key                                    | Value                        | Type     | Encoding           |
| -------------------------------------- | ---------------------------- | -------- | ------------------ |
| `[]byte{0x7} + []byte("lastTxPoolId")` | nonce of outgoing withdrawal | `uint64` | Big endian encoded |

### LastTXPoolID

Injective가 수신한 각 출금에 대해 단조롭게 증가하는 값

| Key                                    | Value                   | Type     | Encoding           |
| -------------------------------------- | ----------------------- | -------- | ------------------ |
| `[]byte{0x6} + []byte("lastTxPoolId")` | Last used withdrawal ID | `uint64` | Big endian encoded |

### OutgoingTxBatch

`OutgoingTxBatch`는 동일한 토큰 유형의 출금 컬렉션을 나타냅니다. 모든 성공적인 `MsgRequestBatch`에서 생성됩니다.

두 가지 방법으로 저장됩니다. 첫 번째는 높이와 함께, 두 번째는 높이 없이(unsafe). Unsafe는 테스트 및 상태 내보내기/가져오기에 사용됩니다.
현재 [Peggy.sol](https://github.com/InjectiveLabs/peggo/blob/master/solidity/contracts/Peggy.sol)은 단일 토큰 유형의 배치만 허용하고 동일한 토큰 유형으로만 보상을 지불하도록 하드코딩되어 있습니다.

```go theme={null}
type OutgoingTxBatch struct {
	BatchNonce    uint64               
	BatchTimeout  uint64               
	Transactions  []*OutgoingTransferTx 
	TokenContract string                
	Block         uint64               
}
```

| key                                                                | Value                            | Type                    | Encoding         |
| ------------------------------------------------------------------ | -------------------------------- | ----------------------- | ---------------- |
| `[]byte{0xa} + []byte(tokenContract) + nonce (big endian encoded)` | A batch of outgoing transactions | `types.OutgoingTxBatch` | Protobuf encoded |
| `[]byte{0xb} + block (big endian encoded)`                         | A batch of outgoing transactions | `types.OutgoingTxBatch` | Protobuf encoded |

### LastOutgoingBatchID

일부 `Batch Creator`에 의해 Injective에서 생성된 각 배치에 대해 단조롭게 증가하는 값

| Key                                   | Value              | Type     | Encoding           |
| ------------------------------------- | ------------------ | -------- | ------------------ |
| `[]byte{0x7} + []byte("lastBatchId")` | Last used batch ID | `uint64` | Big endian encoded |

### SlashedBlockHeight

최신 슬래싱된 블록 높이를 나타냅니다. 항상 단일 값만 저장됩니다.

| Key            | Value                                   | Type     | Encoding           |
| -------------- | --------------------------------------- | -------- | ------------------ |
| `[]byte{0xf7}` | Latest height a batch slashing occurred | `uint64` | Big endian encoded |

### LastUnbondingBlockHeight

`Validator`가 `Validator Set`에서 언본딩을 시작한 최신 블록 높이를 나타냅니다. 슬래싱 조건을 결정하는 데 사용됩니다.

| Key            | Value                                                | Type     | Encoding           |
| -------------- | ---------------------------------------------------- | -------- | ------------------ |
| `[]byte{0xf8}` | Latest height at which a Validator started unbonding | `uint64` | Big endian encoded |

### TokenContract & Denom

상대 체인에서 원래 유래된 denom은 컨트랙트에서 온 것입니다. 토큰 컨트랙트와 denom은 두 가지 방식으로 저장됩니다. 첫째, denom이 키로 사용되고 값은 토큰 컨트랙트입니다. 둘째, 컨트랙트가 키로 사용되고 값은 토큰 컨트랙트가 나타내는 denom입니다.

| Key                                    | Value                  | Type     | Encoding              |
| -------------------------------------- | ---------------------- | -------- | --------------------- |
| `[]byte{0xf3} + []byte(denom)`         | Token contract address | `[]byte` | stored in byte format |
| `[]byte{0xf4} + []byte(tokenContract)` | Token denom            | `[]byte` | stored in byte format |

### LastObservedValset

이 항목은 Ethereum으로 성공적으로 중계된 마지막으로 관찰된 Valset을 나타냅니다. `ValsetUpdatedEvent`의 attestation이 Injective에서 처리된 후 업데이트됩니다.

| Key            | Value                            | Type           | Encoding         |
| -------------- | -------------------------------- | -------------- | ---------------- |
| `[]byte{0xfa}` | Last observed Valset on Ethereum | `types.Valset` | Protobuf encoded |

### LastEventNonce

Ethereum에서 마지막으로 관찰된 이벤트의 nonce. `TryAttestation()`이 호출될 때 설정됩니다. 이 저장소에는 항상 단일 값만 유지됩니다.

| Key            | Value                     | Type     | Encoding           |
| -------------- | ------------------------- | -------- | ------------------ |
| `[]byte{0xf2}` | Last observed event nonce | `uint64` | Big endian encoded |

### LastObservedEthereumHeight

Ethereum에서 마지막으로 관찰된 이벤트의 블록 높이. 이 저장소에는 항상 단일 값만 저장됩니다.

| Key            | Value                         | Type     | Encoding         |
| -------------- | ----------------------------- | -------- | ---------------- |
| `[]byte{0xf9}` | Last observed Ethereum Height | `uint64` | Protobuf encoded |

### LastEventByValidator

특정 `Validator`로부터 Ethereum에서 마지막으로 관찰된 이벤트. 연관된 `Orchestrator`가 이벤트 claim을 보낼 때마다 업데이트됩니다.

```go theme={null}
type LastClaimEvent struct {
    EthereumEventNonce  uint64 
    EthereumEventHeight uint64 
}
```

| Key                                        | Value                                 | Type                   | Encoding         |
| ------------------------------------------ | ------------------------------------- | ---------------------- | ---------------- |
| `[]byte{0xf1} + []byte(validator address)` | Last observed event by some Validator | `types.LastClaimEvent` | Protobuf encoded |

### Attestation

Attestation은 더 많은 투표(claim)가 들어옴에 따라 결국 모든 orchestrator에 의해 관찰되는 claim의 집합입니다. 관찰되면 claim의 특정 로직이 실행됩니다.

각 attestation은 고유한 이벤트 nonce(`Peggy contract`에서 생성)에 바인딩되며 순서대로 처리되어야 합니다. 이는 정확성 문제로, 순서를 벗어나 중계하면 트랜잭션 리플레이 공격이 가능해집니다.

```go theme={null}
type Attestation struct {
	Observed bool       
	Votes    []string   
	Height   uint64     
	Claim    *types.Any 
}
```

| Key                                                                  | Value                                 | Type                | Encoding         |
| -------------------------------------------------------------------- | ------------------------------------- | ------------------- | ---------------- |
| `[]byte{0x5} + event nonce (big endian encoded) + []byte(claimHash)` | Attestation of occurred events/claims | `types.Attestation` | Protobuf encoded |

### PastEthSignatureCheckpoint

검증자 세트/토큰 배치가 실제로 Injective에 존재했음을 나타내는 계산된 해시. 이 체크포인트는 `Peggy contract`에도 존재합니다.
각 새로운 valset 업데이트 및 토큰 배치 생성 시 업데이트됩니다.

| Key            | Value                                     | Type              | Encoding             |
| -------------- | ----------------------------------------- | ----------------- | -------------------- |
| `[]byte{0x1b}` | Last created checkpoint hash on Injective | `gethcommon.Hash` | store in byte format |

### EthereumBlacklist

브릿지 사용이 금지된 알려진 악성 Ethereum 주소 목록.

| Key                                       | Value               | Type              | Encoding               |
| ----------------------------------------- | ------------------- | ----------------- | ---------------------- |
| `[]byte{0x1c} + []byte(ethereum address)` | Empty \[]byte slice | `gethcommon.Hash` | stored in byte format] |
