Solution architecture
This article describes what ready integration should look like and what tasks are expected from integrator.
Last updated
This article describes what ready integration should look like and what tasks are expected from integrator.
Last updated
Earn Api is designed for ease of integration by range of custodians. Goal of this article is to give you overview of your systems' responsibilities when integrating to Tesseract Earn Api without knowing exact systems' architecture on your side.
1. Authentication
OAuth2 Client Credential Flow (M2M) is used to acquire access token (flow omitted from Figure 1) for Earn Api.
-
2. Product list
To display product list for end user Partner must fetch product list from its own data storage. Partner can choose to implement automated sync from Earn Api or have a manually entered copy of Tesseract product list in their database.
1
3. Create Tesseract user and accounts
Before End User is able to deposit to product Earn Api user and account for the product must exist. Partner can choose to do this synchronously at the time of deposit or as a background job somewhere before user can deposit.
1, 2
4. Deposit
Partner calls Earn Api to book user deposit on Earn Api accounting (5a). Partner stores the returned data (5b) for user balance and transaction views. Crypto transaction to Tesseract does not take place yet.
1, 3
5. Balance and transaction views
User balance and transaction details should be fetched from Partner's data storage.
4b, 6b, 8
6. Withdrawal
Partner calls Earn Api to book withdrawal on user account (6a) and stores the returned data (6b) for user balance and transaction views. Crypto transaction to Partner does not take place yet.
1, 4
7. Daily settlement
After Earn Api Accounting cycle execution Partner fetches daily Report from Earn Api (8a). Report gives complete visibility on Earn Api accounting and also contains figures per currency for amounts to settle between Partner and Tesseract. Partner initiates crypto transactions for currencies where netted deposits exceed withdrawals (8b).
1
8. Daily interest sync
Daily Report contains all Journal entries for the day. Partner must sync Interest transaction entries to Partner's data storage. This could be a combined process with Daily settlement.
1
Steps 8. and 9. have dependency to execution of Accounting cycle inside Tesseract Earn platform because they need the reports as input data. Accounting cycle is ran once a day at 00:00 on timezone agreed between Tesseract and Partner. Usually it is UTC.
Accounting cycle is responsible for:
User interest and Partner margin distribution
Daily settlement towards Partner
Creating daily Reports
When Earn API is used to deposit and withdraw assets to accounts, no actual crypto transfers are sent or received. Instead, all deposits and withdrawals are netted per-currency once per day and the outstanding balance for each currency is transferred.
This process is called Daily settlement. Tesseract Earn Api implements the process based on its own accounting data. During the integration process we configure Partner wallet addresses to Earn Api to automatically settle outstanding balance for Partner. Partner has complete visibility on Earn Api accounting through on daily Reports and should implement a similar automated process to settle towards Tesseract.
Tesseract products are operated by multiple legal entities and due to compliance reasons we must have strict separation of funds and accounting between entities.
You will be given one set of authentication credentials per Tesseract legal entity. So you will receive 2 sets of credentials: one set to integrate DeFI products and another set to integrate to Lending products.
Your systems are responsible for mapping this to unified user experience for your End users. For example to produce unified product list for your end users you need to query product list from Earn Api twice. Your systems also need to create 2 Earn Api users per each End user. Mapping between Earn Api users and End users must be stored on Partner systems to be able to make e.g. Earn Api deposit call using correct parameters and credentials.
Diagram on Figure 1. is simplified and omits complexity related to accessing Earn Api with the 2 set of credentials provided.