You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`defindex_fee_receiver`| Public key that receives protocol fees |
98
+
|`vault_fee_receiver`| Public key that receives vault-level fees |
99
+
|`vault_manager`| Can call operational functions (e.g. `investVault`) |
100
+
|`vault_emergency_manager`| Can pause the vault in emergencies |
101
+
|`vault_rebalance_manager`| Can rebalance allocations between strategies |
102
+
|`blend_keeper`| Account authorized to call `harvest` on Blend strategies |
103
+
|`vault_name`| Display name stored in the vault contract |
104
+
|`vault_symbol`| Token symbol for vault shares (e.g. `DFXV`) |
105
+
106
+
> The deployer's secret key must be set in `.env` as `DEPLOYER_SECRET_KEY`. On testnet/standalone, the admin account is airdropped automatically.
107
+
108
+
---
109
+
110
+
#### `public/<network>.contracts.json`
111
+
112
+
Located at `public/testnet.contracts.json` (root of the monorepo, **not** inside `apps/contracts`). This is the **shared address book** used as input by `deploy_vault.ts`. It is also written to by `yarn publish-addresses` (which copies from `apps/contracts/.soroban/`).
113
+
114
+
It must contain the addresses of all external dependencies:
115
+
116
+
```json
117
+
{
118
+
"ids": {
119
+
"soroswap_router": "<address>",
120
+
"blend_fixed_xlm_usdc_pool": "<address>",
121
+
"blend_pool_usdc": "<address>",
122
+
"blend_pool_cetes": "<address>",
123
+
"blnd_token": "<address>",
124
+
"cetes_token": "<address>",
125
+
"soroswap_usdc": "<address>",
126
+
"XLM_blend_strategy": "<address after strategy deploy>",
127
+
"USDC_blend_strategy": "<address after strategy deploy>",
128
+
"CETES_blend_strategy": "<address after strategy deploy>"
129
+
}
130
+
}
82
131
```
83
-
and then you can deploy the factory with the following command:
132
+
133
+
**Strategy addresses** (keys like `<ASSET>_blend_strategy`) must be added manually after running `deploy-blend`. The vault deployment reads from this file to find the strategy address.
A secondary address book scoped to the contracts workspace. Read by `deploy_blend.ts` and `constants.ts` to load token and pool addresses. Must contain the external dependency addresses (tokens, pools, router). **Must be populated manually** — `yarn publish-addresses` writes to the root-level `public/`, not to this file.
140
+
141
+
---
142
+
143
+
#### `.soroban/<network>.contracts.json`
144
+
145
+
Located at `apps/contracts/.soroban/`. This is the **internal address book** written automatically by deployment scripts. It stores every deployed contract address using the key format:
e.g. `cetes_blend_regional_starter_pack_rsp_strategy`
149
+
- Vaults: `<asset>_paltalabs_vault`
150
+
e.g. `cetes_paltalabs_vault`
151
+
152
+
Do not edit this file manually — it is managed by the scripts.
153
+
154
+
---
155
+
156
+
#### `src/strategies/blend_deploy_config.json`
157
+
158
+
Contains the list of Blend strategies to deploy, organized by network. Each strategy entry:
159
+
160
+
```json
161
+
{
162
+
"name": "regional_starter_pack",
163
+
"keeper": "<keeper public key>",
164
+
"asset": "<token contract address>",
165
+
"asset_symbol": "CETES",
166
+
"reward_threshold": "40",
167
+
"blend_pool_address": "<blend pool contract address>",
168
+
"blend_pool_name": "rsp"
169
+
}
84
170
```
85
-
yarn deploy-factory <network>
171
+
172
+
| Field | Description |
173
+
|---|---|
174
+
|`name`| Strategy variant name, used in the resulting contract key |
175
+
|`keeper`| Public key authorized to call `harvest`|
176
+
|`asset`| The underlying token address the strategy manages |
177
+
|`asset_symbol`| Symbol used to filter deploys and build contract keys |
178
+
|`reward_threshold`| Minimum BLND reward amount that triggers auto-compounding. **Note:** currently hardcoded to `40` in `deploy_blend.ts`; this field is not yet read by the deploy script. |
179
+
|`blend_pool_address`| The Blend pool where assets are deposited |
180
+
|`blend_pool_name`| Short name for the pool, used in the resulting contract key |
181
+
182
+
The resulting contract key is: `<asset_symbol>_blend_<name>_<pool_name>_strategy`
183
+
184
+
> `install_contract: "true"` at the network level controls whether the WASM is re-uploaded. Set to `"false"` to reuse an already-installed WASM hash.
185
+
186
+
### Deploying a Blend strategy
187
+
188
+
**1. Configure `blend_deploy_config.json`**
189
+
Add or verify the entry for your asset under the target network. Example for CETES on testnet:
Copy the deployed factory address from the output on `.soroban/<network>.contracts.json` and paste it in `public/<network>.contracts.json`
88
-
or just run the following command to copy it automatically:
89
202
203
+
**2. Ensure the deployer has a trustline for the asset**
204
+
The deployer account (from `DEPLOYER_SECRET_KEY`) must have a trustline for the asset token and hold at least a small balance (~1001 stroops worth), which is required for the bootstrap deposit made automatically on first deploy.
205
+
206
+
**3. Run the deploy script**
207
+
To deploy all strategies for a network:
208
+
```bash
209
+
npm run deploy-blend -- <network>
90
210
```
91
-
yarn publish-addresses <network>
211
+
212
+
To deploy only a specific asset (avoids re-deploying existing strategies):
213
+
```bash
214
+
npm run deploy-blend -- <network><ASSET_SYMBOL>
92
215
```
93
216
94
-
### blend strategies
95
-
First you need to complete the following steps:
96
-
1. review the `blend_deploy_config.json` file to ensure that the strategies are correctly configured. In this file you can see a list of the strategies to deploy and the parameters for each one.
97
-
2. ensure that the addresses in the `<network>.contracts.json` file are correct and match the ones in the `blend_deploy_config.json` file.
98
-
3. ensure that the blend_keeper and blend_deployer secret keys are set in the `.env` file. Also, make sure that the `BLEND_KEEPER_SECRET_KEY` and `BLEND_DEPLOYER_SECRET_KEY` has trustlines set with all the assets that will be used in the strategies.
99
-
4. run the deploy_blend script to deploy the strategies:
217
+
Example:
218
+
```bash
219
+
npm run deploy-blend -- testnet CETES
100
220
```
101
-
yarn deploy-blend <network>
221
+
222
+
The script will:
223
+
- Airdrop the admin account (testnet only)
224
+
- Install the `blend_strategy` WASM (if `install_contract: "true"`)
225
+
- Deploy the strategy contract
226
+
- Make an automatic bootstrap deposit to prevent the first-depositor vulnerability
227
+
- Save the address to `.soroban/<network>.contracts.json`
228
+
229
+
**4. Publish the strategy address**
230
+
After deploying, copy the new strategy address from `.soroban/<network>.contracts.json` and add it to `public/<network>.contracts.json` (root level) using the key `<ASSET_SYMBOL>_blend_strategy`:
231
+
232
+
```json
233
+
"CETES_blend_strategy": "C..."
102
234
```
103
-
5. Then, to make it available for the frontend, you need to copy the new deployed strategies from `.soroban/<network>.contracts.json` into the `~/public/<network>.contracts.json` file.
104
235
105
-
### Deploy vault
106
-
Before deploying a vault, ensure that you have the `~/public/<network>.contracts.json` file updated with the latest contract addresses. This file should contain the addresses of all the necesary contracts deployed on the specified network, such as the factory, strategies, and blend addresses.
236
+
---
237
+
238
+
### Deployment instructions
239
+
240
+
**Prerequisites:**
241
+
242
+
- Factory deployed and address in `public/<network>.contracts.json`
243
+
- Strategy deployed and its address added to `public/<network>.contracts.json` as `<ASSET>_blend_strategy`
244
+
-`configs.json` has correct vault roles for the target network
245
+
246
+
**Run the deploy script:**
247
+
```bash
248
+
npm run deploy-vault -- <network><ASSET_SYMBOL>
249
+
```
107
250
108
-
To deploy a vault, you need to run the following command:
251
+
Example:
252
+
```bash
253
+
npm run deploy-vault -- testnet XLM
109
254
```
110
-
yarn deploy-vault <network> <asset>
255
+
256
+
The script reads:
257
+
258
+
- The strategy address from `public/<network>.contracts.json` → key `<ASSET>_blend_strategy`
259
+
- The factory address from the same file → key `defindex_factory`
260
+
- Vault roles (manager, fee receiver, etc.) from `configs.json`
261
+
262
+
On success it prints the vault address and saves it to `.soroban/<network>.contracts.json` as `<asset>_paltalabs_vault`.
263
+
264
+
> After vault deployment, users deposit into the vault and the vault manager calls `investVault` to allocate funds to the strategy. This is a separate operational step.
265
+
266
+
---
267
+
268
+
### Full deployment sequence (new asset)
269
+
270
+
```bash
271
+
# 1. Build contracts
272
+
make build
273
+
274
+
# 2. Deploy factory (first time only)
275
+
npm run deploy-factory -- testnet
276
+
npm run publish-addresses -- testnet
277
+
278
+
# 3. Add strategy config to blend_deploy_config.json (manual)
279
+
280
+
# 4. Deploy the strategy
281
+
npm run deploy-blend -- testnet CETES
282
+
283
+
# 5. Add strategy address to public/testnet.contracts.json (manual)
284
+
# "CETES_blend_strategy": "<address from .soroban/testnet.contracts.json>"
285
+
286
+
# 6. Deploy the vault
287
+
npm run deploy-vault -- testnet CETES
111
288
```
112
-
where `<network>` is the network you want to deploy to (e.g., `testnet`, `mainnet`) and `<asset>` is the asset you want to use (e.g., `usdc`, `xlm`).
113
-
>[!NOTE] Make sure to double-check that the configuration in the `./configs.json` and the addresses at the public/`<network>`.contracts.json files are correct before deploying.
0 commit comments