# การตั้งค่า

![](/files/-MhhvPCiE0i7FsydZfTf)

จากหัวข้อก่อนหน้านี้ ที่เราได้ Run Command `wallet-gen` เพื่อสร้าง Wallet File และ Configuration File ขึ้นมา

Wallet File (.wallet.json) ไม่ต้องแก้อะไร แก้แค่เฉพาะ Configuration File (.config.json) เท่านั้น ดังนี้

## Configuration File

ตัวอย่าง 0x779fba7799adf15c8476bdbf4dac3770945a2cd4.config.json

```bash
{
  "walletFile" : "0x779fba7799adf15c8476bdbf4dac3770945a2cd4.wallet.json",
  "walletPassword" : "123456",
  "network" : "BSC_MAINNET", 
  "tokenA" : "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //BTCB
  "tokenB" : "0xe9e7cea3dedca5984780bafc599bd69add087d56", //BUSD
  "minimumGasBalance" : 0.005,
  "fillGasTokenBAmount" : 3,
  "swapRouter" : "0x10ED43C718714eb63d5aA57B78B54704E256024E", //PancakeSwap Router 
  "gasSwapRouter" : "0x10ED43C718714eb63d5aA57B78B54704E256024E", //PancakeSwap Router 
  "defaultSwapSlippage" : 0.5,
  "defaultSwapDeadlineMinutes" : 10,
  "tokenAutoApproveMultiplier" : 3.0,
  "differenceAtLeastPercent" : 9.0,
  "swapPercent" : 50.0,
  "swapAtLeastValue" : 1,
  "recipientWhitelist" : []
}
```

**คำอธิบาย**

| Attribute                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Default |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: |
| walletFile                 | อ้างถึง Wallet File ที่คู่กันกับ Configuration File นี้                                                                                                                                                                                                                                                                                                                                                                                                                                           |    -    |
| walletPassword             | เป็นรหัสผ่านเดียวกันกับตอนที่ใช้คำสั่ง `wallet-gen`                                                                                                                                                                                                                                                                                                                                                                                                                                               |    -    |
| network                    | คือ network เดียวกับตอนที่ใช้คำสั่ง `wallet-gen`                                                                                                                                                                                                                                                                                                                                                                                                                                                  |    -    |
| tokenA                     | เป็น Token (Contract) Address ตัวแรกที่เราจะใช้ (แนะนำให้ใช้เป็นตัวที่ไม่ใช่ Stablecoin เช่น BTCB, WBTC, ETH, WBNB ฯลฯ)                                                                                                                                                                                                                                                                                                                                                                           |    -    |
| tokenB                     | เป็น Token (Contract) Address ตัวที่ 2 ที่เราจะใช้ (แนะนำให้ใช้เป็น Stablecoin เช่น BUSD, USDT, USDC, DAI, UST ฯลฯ)                                                                                                                                                                                                                                                                                                                                                                               |    -    |
| minimumGasBalance          | ถ้าจำนวน Gas เหลือต่ำกว่านี้ Bot จะเติม Gas ให้อัตโนมัติ                                                                                                                                                                                                                                                                                                                                                                                                                                          |  0.005  |
| fillGasTokenBAmount        | ถ้าจำนวน Gas เหลือต่ำกว่า `minimumGasBalance`  Bot จะเอา Token B มาจำนวนเท่ากับค่านี้ เพื่อไปซื้อ Gas แล้วเอามาเติมให้อัตโนมัติ                                                                                                                                                                                                                                                                                                                                                                   |    3    |
| swapRouter                 | เป็น Router (Contract) Address ที่ Bot จะไปซื้อ/ขาย หรือแลกเปลี่ยน (Swap) Token                                                                                                                                                                                                                                                                                                                                                                                                                   |    -    |
| gasSwapRouter              | เป็น Router (Contract) Address ที่ Bot จะไปซื้อ หรือแลกเปลี่ยน (Swap) Gas                                                                                                                                                                                                                                                                                                                                                                                                                         |    -    |
| defaultSwapSlippage        | เปอร์เซ็นต์สูญเสีย/คลาดเคลื่อน ที่ยอมรับได้ ถ้า Swap Token แล้วไม่ได้จำนวนตามที่ต้องการ เช่น ยอมให้คลาดเคลื่อนได้ 0.5% เป็นต้น                                                                                                                                                                                                                                                                                                                                                                    |   0.5   |
| defaultSwapDeadlineMinutes | เวลา (นาที) ที่ ถ้า Swap ไม่สำเร็จ Transaction นั้นจะถือว่า Fail ไป                                                                                                                                                                                                                                                                                                                                                                                                                               |    10   |
| tokenAutoApproveMultiplier | <p>ตัวคูณจำนวนในการ Approve Allowance ให้กับ Smart Contract ว่า ให้ Smart Contract นี้สามารถเข้าถึง Token ใน Wallet เราได้ทีละเท่าไหร่ เช่น ถ้าเราตั้งค่าเป็น 3 แล้ว Bot ทำการชื้อ/ขาย BUSD ที่ 5 BUSD <br><br>Smart Contract ที่เราติดต่อด้วย (Router Contract) จะมีสิทธิ์ในการเข้าถึง BUSD ใน Wallet เราได้ไม่เกิน 15 BUSD  (3x) ตอนแรกใช้ชื่อ Attribute ว่า <code>tokenAutoApproveNTimes</code> ตอนนี้เปลี่ยนชื่อ Attribute ใหม่แล้ว ค่านี้เราจะไม่ตั้งเป็น Unlimited เพราะมันเสี่ยงเกินไป</p> |    3    |
| differenceAtLeastPercent   | เปอร์เซ็นต์ที่ ถ้ามูลค่าของ Token A กับ Token B ต่างกันมากกว่าหรือเท่ากับ (>=) ค่านี้แล้ว Bot จะทำการ Rebalance ให้อัตโนมัติ                                                                                                                                                                                                                                                                                                                                                                      |    9    |
| swapPercent                | <p>เปอร์เซ็นที่ Bot ใช้ในการซื้อ/ขาย ถ้าเข้าเงื่อนไข <code>differenceAtLeastPercent</code> (ด้านบน)<br><br>โดยจะซื้อ/ขายจากมูลค่าที่แตกต่างกันจากเงื่อนไขด้านบนเท่านั้น</p>                                                                                                                                                                                                                                                                                                                       |    50   |
| swapAtLeastValue           | มูลค่าอย่างน้อยที่สุด ที่ Bot จะซื้อ/ขาย เช่น ตั้งค่าไว้เป็น 1 BUSD ถ้าเปอร์เซ็นต์ด้านบนถูก แต่ถ้า Bot เห็นว่ามูลค่าซื้อ/ขาย ต่ำกว่า 1 BUSD ก็จะไม่ซื้อ/ขาย เพราะเปลืองค่า Gas                                                                                                                                                                                                                                                                                                                    |    1    |
| recipientWhitelist         | รายการผู้รับ (Token Address) ที่อนุญาตเท่านั้น ใช้ในกรณีการโอน Token ออกจาก iWallet จะอธิบายเพิ่มเติมในหัวข้อ [การโอน Token ออกจาก iWallet](/transfer/out.md) อีกครั้ง                                                                                                                                                                                                                                                                                                                            |   \[ ]  |

## ไม่รู้จะแก้ค่าอะไร ให้แก้ค่าต่อไปนี้&#x20;

* network
* tokenA&#x20;
* tokenB &#x20;
* swapRouter
* gasSwapRouter

ค่าอื่น ๆ ปล่อยเป็น Default ไป

เมื่อใช้งานจนคล่องแล้ว ค่อยลองปรับค่าต่าง ๆ ดู


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://iwallet.jittagornp.me/installation/settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
