|
| 1 | +# Liquidity Provider Trusted Accounts |
| 2 | + |
| 3 | +## 🧠 Summary |
| 4 | +The **Liquidity Provider Trusted Accounts** feature extends the existing **Liquidity Provider Server (LPS)** and **FlyoverSDK** to allow Liquidity Providers (LPs) to configure a set of trusted Rootstock accounts that can bypass certain validation checks — such as the **reCAPTCHA** verification — during **PegIn** or **PegOut** operations. |
| 5 | + |
| 6 | +This functionality is part of the **Flyover Protocol**, aimed at enabling automated integrations for partners and liquidity providers who operate frequently. |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## 🏗 Architecture and Design |
| 11 | + |
| 12 | +### Components |
| 13 | +This feature adds functionality to two existing components: |
| 14 | +1. **Liquidity Provider Server (LPS)** – Enables LPs to configure and manage trusted accounts with BTC/RBTC locking caps. |
| 15 | +2. **FlyoverSDK** – Provides new methods that allow integrators to sign and submit quotes authenticated by trusted accounts. |
| 16 | + |
| 17 | +### Design Notes |
| 18 | +- Backward compatible with existing FlyoverSDK versions `>= v1.7.0` and LPS versions `>= v2.3.0`. |
| 19 | +- The account paying for the operation doesn’t need to be the same as the whitelisted account, but a valid signature of the quote hash from the trusted account must be provided. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## ⚙️ Setup and Configuration |
| 24 | + |
| 25 | +### Environment Requirements |
| 26 | +- **FlyoverSDK:** `>= v1.70` |
| 27 | +- **LPS:** `>= v2.3.0` |
| 28 | + |
| 29 | +### Configuration |
| 30 | +- The LP must configure authorized trusted accounts in their **LPS instance**. |
| 31 | +- No additional `.env` variables or feature flags are required. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## 🔌 API / Interface Details |
| 36 | + |
| 37 | +### FlyoverSDK Methods |
| 38 | + |
| 39 | +- `async acceptAuthenticatedQuote(quote: Quote, signature: string): Promise<AcceptedQuote>`: Accepts a PegIn quote authenticated by a trusted account’s signature. |
| 40 | +- `async acceptAuthenticatedPegoutQuote(quote: PegoutQuote, signature: string): Promise<AcceptedPegoutQuote>`: Accepts a PegOut quote authenticated by a trusted account’s signature. |
| 41 | +- `async signQuote(quote: Quote | PegoutQuote): Promise<string>`: Generates a valid signature for a given quote using the whitelisted Rootstock account. |
| 42 | + |
| 43 | +### Input / Output |
| 44 | +Same input and output as `acceptQuote` and `acceptPegoutQuote`. |
| 45 | +The difference is that these methods require a **`signature`** parameter, obtained via: |
| 46 | +- The `signQuote()` SDK method, or |
| 47 | +- A manually created signature by the SDK integrator. |
| 48 | + |
| 49 | +### Possible errors |
| 50 | +Both error types are raised as **`FlyoverError`** instances: |
| 51 | +| Error Scenario | Description | |
| 52 | +|----------------|--------------| |
| 53 | +| Invalid Signature | The provided signature does not match a whitelisted account. | |
| 54 | +| Locking Cap Exceeded | The account exceeded its assigned BTC/RBTC locking cap. | |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## 🧭 Integration Guide |
| 59 | + |
| 60 | +To integrate this feature: |
| 61 | + |
| 62 | +1. Ensure you are using **FlyoverSDK >= v1.70**. |
| 63 | +2. Obtain a whitelisted Rootstock account from your Liquidity Provider. |
| 64 | +3. Use the SDK’s `signQuote` method to sign your quote hash. |
| 65 | +4. Use the authenticated accept method (`acceptAuthenticatedQuote` or `acceptAuthenticatedPegoutQuote`) with the quote and signature. |
| 66 | +5. The LP’s LPS instance will validate the signature against its trusted accounts configuration. |
| 67 | + |
| 68 | +> 🔐 Only accounts whitelisted by an LP will be accepted. |
| 69 | +> Each account has a configured BTC/RBTC locking cap that restricts usage volume. |
| 70 | +
|
| 71 | +### Authentication |
| 72 | +Trust is based solely on account whitelisting and signature verification. |
| 73 | + |
| 74 | +### Integration Entry Points |
| 75 | +- Primary integration via **FlyoverSDK** |
| 76 | +- No direct API calls required |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +## 🧪 Testing |
| 81 | + |
| 82 | +### Local Testing Setup |
| 83 | +- Deploy a **local LPS instance**. |
| 84 | +- Configure one or more trusted accounts. |
| 85 | +- Test using the new SDK methods with valid and invalid signatures to validate expected behavior. |
| 86 | + |
| 87 | +### Test Utilities |
| 88 | +Example tests and automation demos can be found in: |
| 89 | +🔗 [Flyover SDK Automation Demo](https://github.com/rsksmart/flyover-sdk/tree/main/utilities/pegin-pegout-automation-demo) |
| 90 | + |
| 91 | +### Notes |
| 92 | +Follow the documentation in the above repository for commands and setup steps. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## 🧾 Changelog |
| 97 | +| Component | Version | Release Link | |
| 98 | +|------------|----------|---------------| |
| 99 | +| FlyoverSDK | v1.7.0 | [GitHub Release](https://github.com/rsksmart/flyover-sdk/releases/tag/v1.7.0) | |
| 100 | +| LPS | v2.3.0 | [GitHub Release](https://github.com/rsksmart/liquidity-provider-server/releases/tag/v2.3.0) | |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## 📦 Related Resources |
| 105 | +- **Flyover SDK (npm):** [@rsksmart/flyover-sdk](https://www.npmjs.com/package/@rsksmart/flyover-sdk) |
| 106 | +- **GitHub Repo:** [Flyover SDK](https://github.com/rsksmart/flyover-sdk) |
0 commit comments