# Run & Query

## How to Run

* You can start the deposit\_to\_l2\_job by adding the following arguments:

```shell
-O TokenDepositTransaction,TokenDepositTransaction --force-filter-mode true
or
-E DEPOSIT_TO_L2 --force-filter-mode true
```

Before starting job, user needs to configure the monitored l2 chain contract.

Here's the template for the configuration file.

### Token name Configuration

The configuration table includes a {token\_type} configuration item. In the current program, this is an enumerated value with the following options:

* `eth`
* `usdc`
* `Custom field`

The custom field option matches the name field in the decode section of the abi\_function. This tells the program which field represents the deposit token after decoding. Note: eth and usdc are internal configuration values. Typically, the deposit contract methods for these two tokens do not record the token address separately in the input data.

### ABI Function Specifics

In the abi\_function, the field name representing the deposit amount after decoding should be recorded as `_amount`.

```
[chain_deposit_info]
contract_info=
    {
        "{chain_id}":[{
            "contract": "{contract_address}",
            "ABIFunction": [
            {
                "token": "{token_name}",
                "json": {full json of abi function}
            },
            ……
            ]
        }],
        ……
    }
```

Here are part of the configuration information that are currently running

```
[chain_deposit_info]
contract_info=
    {
        "8453":[{
            "contract": "0x3154Cf16ccdb4C6d922629664174b904d80F2C35",
            "ABIFunction": [
            {
                "token": "eth",
                "json": {"inputs":[{"internalType":"uint32","name":"_minGasLimit","type":"uint32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"depositETH","outputs":[],"stateMutability":"payable","type":"function"}
            },
            {
                "token": "eth",
                "json":{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint32","name":"_minGasLimit","type":"uint32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"bridgeETHTo","outputs":[],"stateMutability":"payable","type":"function"}
            }]
        }],
        "10":[{
            "contract": "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1",
            "ABIFunction": [
            {
                "token": "eth",
                "json": {"inputs":[{"internalType":"uint32","name":"_minGasLimit","type":"uint32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"depositETH","outputs":[],"stateMutability":"payable","type":"function"}
            },
            {
                "token": "eth",
                "json":{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint32","name":"_minGasLimit","type":"uint32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"bridgeETHTo","outputs":[],"stateMutability":"payable","type":"function"}
            },
            {
                "token": "_l1Token",
                "json": {"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_l2Token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint32","name":"_minGasLimit","type":"uint32"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"depositERC20To","outputs":[],"stateMutability":"nonpayable","type":"function"}
            }]
        }]
    }
```

## Public API

### GET /v1/aci/{wallet\_address}/deposit/current

Get the total amount of deposits on each monitoring l2 chain for the current address

```json
{
    "wallet_address": "0x07AE8551BE970CB1CCA11DD7A11F47AE82E70E67",
    "deposit_times": 35,
    "chain_list": [
        "arbitrum",
        "linea"
    ],
    "asset_list": [
        {
            "chain": "linea",
            "bridge": "0x051f1d88f0af5763fb888ec4378b4d8b29ea3319",
            "token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 113891426.0
        },
        {
            "chain": "arbitrum",
            "bridge": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
            "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 389739663425.0
        },
        {
            "chain": "arbitrum",
            "bridge": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
            "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 632746985369.0
        },
        {
            "chain": "arbitrum",
            "bridge": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
            "token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 628399963.0
        },
        {
            "chain": "linea",
            "bridge": "0x504a330327a089d8364c4ab3811ee26976d388ce",
            "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 59479591975.0
        },
        {
            "chain": "arbitrum",
            "bridge": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
            "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 1.8289342516725786e+21
        },
        {
            "chain": "arbitrum",
            "bridge": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
            "token": "0x6b175474e89094c44da98b954eedeac495271d0f",
            "token_name": null,
            "token_symbol": null,
            "token_icon_url": null,
            "token_type": null,
            "amount": 3.095182829935051e+23
        }
    ]
}
```

### GET /v1/aci/deposit/transactions

Query the detailed data of the deposit transaction according to the filter criteria

Response:

```json
{
  "data": [
    {
      "transaction_hash": "0x4769f88dfe3a7aaafffd180837e71a10c29a9ad8d6a3b1481224de7646ab78d0",
      "wallet_address": "0x07ae8551be970cb1cca11dd7a11f47ae82e70e67",
      "chain_id": 42161,
      "contract_address": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
      "token_address": "0x6b175474e89094c44da98b954eedeac495271d0f",
      "value": "31856.204529119157086825",
      "block_number": 20686814,
      "block_timestamp": "2024-09-05T20:35:47+08:00",
      "chain_name": "arbitrum",
      "name": null,
      "symbol": null,
      "icon_url": null,
      "token_type": null
    },
    {
      "transaction_hash": "0x07f0757d788ae9779c1958b4f3c5dbff0f2b6f5be4023252d612bd7d01fb2b8c",
      "wallet_address": "0x07ae8551be970cb1cca11dd7a11f47ae82e70e67",
      "chain_id": 42161,
      "contract_address": "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",
      "token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "value": "0.000000060012277694",
      "block_number": 20686447,
      "block_timestamp": "2024-09-05T19:22:11+08:00",
      "chain_name": "arbitrum",
      "name": null,
      "symbol": null,
      "icon_url": null,
      "token_type": null
    }
  ],
  "total": 35,
  "max_display": 35,
  "page": 1,
  "size": 25
}
```
