|
| 1 | +--- |
| 2 | +title: LP Migration Utilities |
| 3 | +--- |
| 4 | + |
| 5 | +# LP Migration Utilities |
| 6 | + |
| 7 | +This document describes the utility scripts that help Liquidity Providers migrate liquidity to the new contract set. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- Access to the Rootstock RPC endpoint for the target network. |
| 12 | +- Wallet secrets configured via the same mechanisms used by the LPS (`--secret-src env|aws`). |
| 13 | + |
| 14 | +## Build the utilities |
| 15 | + |
| 16 | +```bash |
| 17 | +make utils |
| 18 | +``` |
| 19 | + |
| 20 | +The binaries will be placed in the `./utils` directory. |
| 21 | + |
| 22 | +## Common options |
| 23 | + |
| 24 | +Both scripts reuse the base input flags from `cmd/utils/scripts`: |
| 25 | + |
| 26 | +- `--network` (required): `regtest`, `testnet`, or `mainnet` |
| 27 | +- `--rsk-endpoint` (required): RPC URL (e.g. `http://localhost:4444`) |
| 28 | +- `--secret-src` (required): `env` or `aws` |
| 29 | +- `--keystore-file`: required when `--secret-src=env` |
| 30 | +- `--keystore-secret` and `--password-secret`: required when `--secret-src=aws` |
| 31 | +- `--custom-pegin-address`, `--custom-collateral-address`, `--custom-pegout-address`, `--custom-discovery-address`: optional overrides |
| 32 | + |
| 33 | +### Default regtest env file |
| 34 | + |
| 35 | +If you want to run the utilities with minimal flags (for example `./utils/resign_utils --resign`), you can provide defaults via an env file: |
| 36 | + |
| 37 | +- Set `LPS_UTILS_ENV_FILE` to a file containing `LPS_STAGE`, `RSK_ENDPOINT`, `SECRET_SRC`, `AWS_LOCAL_ENDPOINT`, and wallet keys such as `WALLET_FILE`, `WALLET_SECRET`, and `PASSWORD_SECRET`. |
| 38 | +- If `LPS_UTILS_ENV_FILE` is not set, the utilities will try `docker-compose/local/.env.regtest`, then `regtest.env` at the repo root. |
| 39 | +- A minimal `regtest.env` is included for local regtest defaults; adjust it to match your environment. |
| 40 | + |
| 41 | +## Resign utility |
| 42 | + |
| 43 | +### Resign |
| 44 | + |
| 45 | +```bash |
| 46 | +./utils/resign_utils \ |
| 47 | + --network testnet \ |
| 48 | + --rsk-endpoint http://localhost:4444 \ |
| 49 | + --secret-src env \ |
| 50 | + --keystore-file /path/to/keystore.json \ |
| 51 | + --resign |
| 52 | +``` |
| 53 | + |
| 54 | +### Withdraw collateral |
| 55 | + |
| 56 | +```bash |
| 57 | +./utils/resign_utils \ |
| 58 | + --network testnet \ |
| 59 | + --rsk-endpoint http://localhost:4444 \ |
| 60 | + --secret-src env \ |
| 61 | + --keystore-file /path/to/keystore.json \ |
| 62 | + --withdraw-collateral |
| 63 | +``` |
| 64 | + |
| 65 | +Note: `--withdraw-collateral` requires the resignation delay to have elapsed after calling `--resign`. |
| 66 | + |
| 67 | +## Withdraw utility |
| 68 | + |
| 69 | +### Withdraw full balance |
| 70 | + |
| 71 | +```bash |
| 72 | +./utils/withdraw \ |
| 73 | + --network testnet \ |
| 74 | + --rsk-endpoint http://localhost:4444 \ |
| 75 | + --secret-src env \ |
| 76 | + --keystore-file /path/to/keystore.json \ |
| 77 | + --all |
| 78 | +``` |
| 79 | + |
| 80 | +### Withdraw a specific amount |
| 81 | + |
| 82 | +```bash |
| 83 | +./utils/withdraw \ |
| 84 | + --network testnet \ |
| 85 | + --rsk-endpoint http://localhost:4444 \ |
| 86 | + --secret-src env \ |
| 87 | + --keystore-file /path/to/keystore.json \ |
| 88 | + --amount 1000000000000000000 |
| 89 | +``` |
| 90 | + |
| 91 | +The `--amount` value is expressed in wei. |
0 commit comments