biatec-concentrated-liquidity-amm 0.9.33 โ 0.9.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -0
- package/dist/index.d.mts +379 -156
- package/dist/index.d.ts +379 -156
- package/dist/index.js +587 -447
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +580 -444
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -30,6 +30,16 @@ npm i biatec-concentrated-liquidity-amm
|
|
|
30
30
|
|
|
31
31
|
## Examples
|
|
32
32
|
|
|
33
|
+
### Retrieve deployed app IDs
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { getConfig } from 'biatec-concentrated-liquidity-amm';
|
|
37
|
+
|
|
38
|
+
const { configAppId, identityAppId, poolProviderAppId } = getConfig('testnet-v1.0');
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Supported genesis IDs are `mainnet-v1.0`, `voimain-v1.0`, and `testnet-v1.0`. The helper throws if you pass an unsupported network so deployments stay explicit.
|
|
42
|
+
|
|
33
43
|
## Add liquidity
|
|
34
44
|
|
|
35
45
|
```
|
|
@@ -106,3 +116,108 @@ const txId = await clammRemoveLiquiditySender({
|
|
|
106
116
|
lpToSend: bigint;
|
|
107
117
|
})
|
|
108
118
|
```
|
|
119
|
+
|
|
120
|
+
## Staking Pools (NEW)
|
|
121
|
+
|
|
122
|
+
BiatecCLAMM now supports staking pools where asset A and asset B are the same token. This enables creation of interest-bearing tokens like B-ALGO, B-USDC, etc.
|
|
123
|
+
|
|
124
|
+
### Creating a Native Token Staking Pool (B-ALGO)
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { clammCreateSender } from 'biatec-concentrated-liquidity-amm';
|
|
128
|
+
|
|
129
|
+
await poolProviderClient.send.setNativeTokenName({
|
|
130
|
+
args: {
|
|
131
|
+
appBiatecConfigProvider: configAppId,
|
|
132
|
+
nativeTokenName: 'ALGO',
|
|
133
|
+
},
|
|
134
|
+
appReferences: [configAppId],
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const poolClient = await clammCreateSender({
|
|
138
|
+
transactionSigner: signerAccount,
|
|
139
|
+
clientBiatecPoolProvider: poolProviderClient,
|
|
140
|
+
appBiatecConfigProvider: configAppId,
|
|
141
|
+
assetA: 0n, // Native token (ALGO)
|
|
142
|
+
assetB: 0n, // Same as asset A
|
|
143
|
+
fee: 0n, // No fee
|
|
144
|
+
verificationClass: 0,
|
|
145
|
+
priceMin: BigInt(SCALE),
|
|
146
|
+
priceMax: BigInt(SCALE),
|
|
147
|
+
currentPrice: BigInt(SCALE),
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Distributing Staking Rewards
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import { clammDistributeExcessAssetsSender } from 'biatec-concentrated-liquidity-amm';
|
|
155
|
+
|
|
156
|
+
// After rewards accrue to the pool (e.g., from consensus rewards)
|
|
157
|
+
// Note: rewardsAmount should already be in asset decimals (e.g., microAlgos)
|
|
158
|
+
// Convert to base scale (9 decimals) by multiplying with scale factor
|
|
159
|
+
const rewardsInBaseScale = (rewardsAmount * BigInt(SCALE)) / BigInt(assetDecimals);
|
|
160
|
+
|
|
161
|
+
const txId = await clammDistributeExcessAssetsSender({
|
|
162
|
+
algod,
|
|
163
|
+
account: executiveSigner,
|
|
164
|
+
amountA: rewardsInBaseScale, // Amount in base scale (9 decimals)
|
|
165
|
+
amountB: 0n,
|
|
166
|
+
appBiatecConfigProvider: configAppId,
|
|
167
|
+
assetA: 0n,
|
|
168
|
+
assetB: 0n,
|
|
169
|
+
clientBiatecClammPool: poolClient,
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
For complete documentation, see [docs/staking-pools.md](docs/staking-pools.md).
|
|
174
|
+
|
|
175
|
+
### Key Features:
|
|
176
|
+
|
|
177
|
+
- **Create Interest-Bearing Tokens**: Build B-ALGO, B-USDC, or any B-{TOKEN}
|
|
178
|
+
- **Support Multi-Chain Networks**: Works with ALGO, VOI, ARAMID chains
|
|
179
|
+
- **Distribute Rewards to LP Holders**: Share staking rewards, interest, or fees
|
|
180
|
+
- **Enable Flexible Use Cases**: Power lending protocols, yield aggregation, revenue sharing
|
|
181
|
+
|
|
182
|
+
### Use Cases:
|
|
183
|
+
|
|
184
|
+
1. **Native Token Staking**: B-ALGO pools for staking ALGO with consensus rewards
|
|
185
|
+
2. **Asset Staking**: B-USDC pools for lending protocol interest
|
|
186
|
+
3. **Revenue Sharing**: Distribute protocol fees to token holders
|
|
187
|
+
4. **Yield Aggregation**: Combine multiple yield sources
|
|
188
|
+
|
|
189
|
+
## Documentation
|
|
190
|
+
|
|
191
|
+
Comprehensive documentation is available in the `docs/` folder:
|
|
192
|
+
|
|
193
|
+
### Core Documentation
|
|
194
|
+
- **[Basic Use Cases](docs/basic-use-cases.md)** - Getting started with pools, swaps, and liquidity
|
|
195
|
+
- **[Staking Pools](docs/staking-pools.md)** - Create B-ALGO, B-USDC interest-bearing tokens
|
|
196
|
+
- **[Integration Guide](docs/integration-guide.md)** - Best practices for integrating CLAMM into your application
|
|
197
|
+
|
|
198
|
+
### Technical Details
|
|
199
|
+
- **[Liquidity Fee Protection](docs/liquidity-fee-protection.md)** - How fee accounting protects LPs
|
|
200
|
+
- **[Liquidity Rounding](docs/liquidity-rounding.md)** - Rounding behavior and user expectations
|
|
201
|
+
- **[Error Codes](docs/error-codes.md)** - Complete reference of all error messages
|
|
202
|
+
|
|
203
|
+
### Security
|
|
204
|
+
- **[Security Audits](audits/)** - Multiple AI-powered security audit reports
|
|
205
|
+
- **[Integration Security](docs/integration-guide.md#security-considerations)** - Critical warnings for developers
|
|
206
|
+
|
|
207
|
+
### Key Resources
|
|
208
|
+
|
|
209
|
+
- ๐ **Error Troubleshooting**: See [error-codes.md](docs/error-codes.md) for solutions
|
|
210
|
+
- ๐ **Security Best Practices**: Review [integration-guide.md](docs/integration-guide.md) before deployment
|
|
211
|
+
- ๐งช **Testing**: Examples in `__test__/` folder show proper usage patterns
|
|
212
|
+
- ๐ก๏ธ **Audit Reports**: Six AI security audits in `audits/` folder
|
|
213
|
+
|
|
214
|
+
## Security Considerations
|
|
215
|
+
|
|
216
|
+
โ ๏ธ **Important Security Notices**:
|
|
217
|
+
|
|
218
|
+
1. **Price Oracle Usage**: Never use single pool VWAP as sole price source. See [integration guide](docs/integration-guide.md#using-clamm-as-price-oracle) for safe patterns.
|
|
219
|
+
2. **Slippage Protection**: Always enforce minimum slippage (โฅ0.5%). Never use `minimumToReceive = 0`.
|
|
220
|
+
3. **Identity Verification**: All operations require proper KYC verification class.
|
|
221
|
+
4. **LP Token Rounding**: Small rounding losses (< 0.0001%) are expected. See [liquidity-rounding.md](docs/liquidity-rounding.md).
|
|
222
|
+
|
|
223
|
+
Multiple security audits have been conducted. Review the `audits/` folder before mainnet deployment.
|