> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therootnetwork.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Erc20Peg

## Calls

### activateDeposits

Activate/deactivate deposits (root only)

**Namespace**

```
api.tx.erc20Peg.activateDeposits
```

**Type**

```
function activateDeposits(
  activate: bool
)
```

### activateWithdrawals

Activate/deactivate withdrawals (root only)

**Namespace**

```
api.tx.erc20Peg.activateWithdrawals
```

**Type**

```
function activateWithdrawals(
  activate: bool
)
```

### setErc20AssetMap

**Namespace**

```
api.tx.erc20Peg.setErc20AssetMap
```

**Type**

```
function setErc20AssetMap(
  asset_id: u32,
  eth_address: H160
)
```

### setErc20Meta

**Namespace**

```
api.tx.erc20Peg.setErc20Meta
```

**Type**

```
function setErc20Meta(
  details: Vec<(H160,Bytes,u8)>
)
```

### setErc20PegAddress

**Namespace**

```
api.tx.erc20Peg.setErc20PegAddress
```

**Type**

```
function setErc20PegAddress(
  eth_address: H160
)
```

### setPaymentDelay

**Namespace**

```
api.tx.erc20Peg.setPaymentDelay
```

**Type**

```
function setPaymentDelay(
  asset_id: u32,
  min_balance: u128,
  delay: u32
)
```

### setRootPegAddress

**Namespace**

```
api.tx.erc20Peg.setRootPegAddress
```

**Type**

```
function setRootPegAddress(
  eth_address: H160
)
```

### withdraw

**Namespace**

```
api.tx.erc20Peg.withdraw
```

**Type**

```
function withdraw(
  asset_id: u32,
  amount: u128,
  beneficiary: H160
)
```

## Storage

### assetIdToErc20

Map GA asset Id to ERC20 address

**Namespace**

```
api.query.erc20Peg.assetIdToErc20
```

**Type**

```
function assetIdToErc20(
  u32
): Option<H160>
```

### contractAddress

The peg contract address on Ethereum

**Namespace**

```
api.query.erc20Peg.contractAddress
```

**Type**

```
function contractAddress(

): H160
```

### delayedPayments

Map from DelayedPaymentId to PendingPayment

**Namespace**

```
api.query.erc20Peg.delayedPayments
```

**Type**

```
function delayedPayments(
  u64
): Option<PalletErc20PegPendingPayment>
```

### delayedPaymentSchedule

Map from block number to DelayedPaymentIds scheduled for that block

**Namespace**

```
api.query.erc20Peg.delayedPaymentSchedule
```

**Type**

```
function delayedPaymentSchedule(
  u32
): Vec<u64>
```

### depositsActive

Whether deposit are active

**Namespace**

```
api.query.erc20Peg.depositsActive
```

**Type**

```
function depositsActive(

): bool
```

### erc20Meta

Metadata for well-known erc20 tokens (symbol, decimals)

**Namespace**

```
api.query.erc20Peg.erc20Meta
```

**Type**

```
function erc20Meta(
  H160
): Option<(Bytes,u8)>
```

### erc20ToAssetId

Map ERC20 address to GA asset Id

**Namespace**

```
api.query.erc20Peg.erc20ToAssetId
```

**Type**

```
function erc20ToAssetId(
  H160
): Option<u32>
```

### nextDelayedPaymentId

The next available payment id for withdrawals and deposits

**Namespace**

```
api.query.erc20Peg.nextDelayedPaymentId
```

**Type**

```
function nextDelayedPaymentId(

): u64
```

### paymentDelay

Map from asset\_id to minimum amount and delay

**Namespace**

```
api.query.erc20Peg.paymentDelay
```

**Type**

```
function paymentDelay(
  u32
): Option<(u128,u32)>
```

### readyBlocks

The blocks with payments that are ready to be processed

**Namespace**

```
api.query.erc20Peg.readyBlocks
```

**Type**

```
function readyBlocks(

): Vec<u32>
```

### rootPegContractAddress

The ROOT peg contract address on Ethereum

**Namespace**

```
api.query.erc20Peg.rootPegContractAddress
```

**Type**

```
function rootPegContractAddress(

): H160
```

### withdrawalsActive

Whether withdrawals are active

**Namespace**

```
api.query.erc20Peg.withdrawalsActive
```

**Type**

```
function withdrawalsActive(

): bool
```

## Events

### DelayedErc20DepositFailed

A delayed erc20 deposit has failed (payment\_id, beneficiary)

**Namespace**

```
api.events.erc20Peg.DelayedErc20DepositFailed
```

**Type**

```
type DelayedErc20DepositFailed = {
  param0: u64,
  param1: SeedPrimitivesSignatureAccountId20
}
```

### DelayedErc20WithdrawalFailed

A delayed erc20 withdrawal has failed (asset\_id, beneficiary)

**Namespace**

```
api.events.erc20Peg.DelayedErc20WithdrawalFailed
```

**Type**

```
type DelayedErc20WithdrawalFailed = {
  param0: u32,
  param1: H160
}
```

### Erc20Deposit

A bridged erc20 deposit succeeded. (asset, amount, beneficiary)

**Namespace**

```
api.events.erc20Peg.Erc20Deposit
```

**Type**

```
type Erc20Deposit = {
  param0: u32,
  param1: u128,
  param2: SeedPrimitivesSignatureAccountId20
}
```

### Erc20DepositDelayed

An erc20 deposit has been delayed.(payment\_id, scheduled block, amount, beneficiary)

**Namespace**

```
api.events.erc20Peg.Erc20DepositDelayed
```

**Type**

```
type Erc20DepositDelayed = {
  param0: u64,
  param1: u32,
  param2: u128,
  param3: SeedPrimitivesSignatureAccountId20
}
```

### Erc20DepositFail

A bridged erc20 deposit failed. (source address, abi data)

**Namespace**

```
api.events.erc20Peg.Erc20DepositFail
```

**Type**

```
type Erc20DepositFail = {
  param0: H160,
  param1: Bytes
}
```

### Erc20Withdraw

Tokens were burnt for withdrawal on Ethereum as ERC20s (asset, amount, beneficiary)

**Namespace**

```
api.events.erc20Peg.Erc20Withdraw
```

**Type**

```
type Erc20Withdraw = {
  param0: u32,
  param1: u128,
  param2: H160
}
```

### Erc20WithdrawalDelayed

A withdrawal has been delayed.(payment\_id, scheduled block, amount, beneficiary)

**Namespace**

```
api.events.erc20Peg.Erc20WithdrawalDelayed
```

**Type**

```
type Erc20WithdrawalDelayed = {
  param0: u64,
  param1: u32,
  param2: u128,
  param3: H160
}
```

### NoAvailableDelayedPaymentIds

There are no more payment ids available, they've been exhausted

**Namespace**

```
api.events.erc20Peg.NoAvailableDelayedPaymentIds
```

**Type**

```
type NoAvailableDelayedPaymentIds = {

}
```

### PaymentDelaySet

A delay was added for an asset\_id (asset\_id, min\_balance, delay)

**Namespace**

```
api.events.erc20Peg.PaymentDelaySet
```

**Type**

```
type PaymentDelaySet = {
  param0: u32,
  param1: u128,
  param2: u32
}
```

### SetContractAddress

The peg contract address has been set

**Namespace**

```
api.events.erc20Peg.SetContractAddress
```

**Type**

```
type SetContractAddress = {
  param0: H160
}
```

### SetRootPegContract

The ROOT peg contract address has been set

**Namespace**

```
api.events.erc20Peg.SetRootPegContract
```

**Type**

```
type SetRootPegContract = {
  param0: H160
}
```

## Errors

### CreateAssetFailed

Could not create the bridged asset

**Namespace**

```
api.errors.erc20Peg.CreateAssetFailed
```

### DepositsPaused

Deposits are inactive

**Namespace**

```
api.errors.erc20Peg.DepositsPaused
```

### EvmWithdrawalFailed

Withdrawals over the set payment delay for EVM calls are disabled

**Namespace**

```
api.errors.erc20Peg.EvmWithdrawalFailed
```

### InvalidAbiEncoding

The abi received does not match the encoding scheme

**Namespace**

```
api.errors.erc20Peg.InvalidAbiEncoding
```

### InvalidAmount

Deposit has bad amount

**Namespace**

```
api.errors.erc20Peg.InvalidAmount
```

### InvalidPalletId

Could not convert pallet id to account

**Namespace**

```
api.errors.erc20Peg.InvalidPalletId
```

### InvalidSourceAddress

The peg source address is incorrect for the token being bridged

**Namespace**

```
api.errors.erc20Peg.InvalidSourceAddress
```

### UnsupportedAsset

Withdrawals of this asset are not supported

**Namespace**

```
api.errors.erc20Peg.UnsupportedAsset
```

### WithdrawalsPaused

Withdrawals are inactive

**Namespace**

```
api.errors.erc20Peg.WithdrawalsPaused
```

undefined
