Skip to content

Commit f3cc9b7

Browse files
committed
Update README and CHANGELOG for moolah-lending-sdk and moolah-sdk-core; version bump to 1.0.1 with improved documentation and dependency updates.
1 parent f7d2c66 commit f3cc9b7

7 files changed

Lines changed: 105 additions & 64 deletions

File tree

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,14 @@ console.log(`Remaining: ${remaining.toFormat(2)}`);
329329

330330
### Simulate Functions (Decimal-based)
331331

332-
| Function | Description |
333-
| ---------------------------------- | ---------------------------------- |
334-
| `simulateMarketBorrow(params)` | Simulate market borrow operation |
335-
| `simulateMarketRepay(params)` | Simulate market repay operation |
336-
| `simulateVaultDeposit(params)` | Simulate vault deposit operation |
337-
| `simulateVaultWithdraw(params)` | Simulate vault withdraw operation |
338-
| `simulateSmartMarketBorrow(params)`| Simulate smart market borrow |
339-
| `simulateSmartMarketRepay(params)` | Simulate smart market repay |
332+
| Function | Description |
333+
| ----------------------------------- | --------------------------------- |
334+
| `simulateMarketBorrow(params)` | Simulate market borrow operation |
335+
| `simulateMarketRepay(params)` | Simulate market repay operation |
336+
| `simulateVaultDeposit(params)` | Simulate vault deposit operation |
337+
| `simulateVaultWithdraw(params)` | Simulate vault withdraw operation |
338+
| `simulateSmartMarketBorrow(params)` | Simulate smart market borrow |
339+
| `simulateSmartMarketRepay(params)` | Simulate smart market repay |
340340

341341
### Interest Rate Functions
342342

@@ -358,13 +358,6 @@ pnpm lint # Lint code
358358
pnpm check:types # Type check
359359
```
360360

361-
## Publishing
362-
363-
```bash
364-
pnpm changeset # Create changeset
365-
pnpm release # Version bump + publish
366-
```
367-
368361
## License
369362

370363
MIT

packages/moolah-lending-sdk/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @lista-dao/moolah-lending-sdk
22

3+
## 1.0.1
4+
5+
### Patch Changes
6+
7+
- Update readme files
8+
- Updated dependencies
9+
- @lista-dao/moolah-sdk-core@1.0.1
10+
311
## 1.0.0
412

513
### Major Changes

packages/moolah-lending-sdk/README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,36 @@ for (const step of steps) {
4545

4646
```typescript
4747
interface StepParam {
48-
stepType: "approve" | "main";
48+
step:
49+
| "approve"
50+
| "supply"
51+
| "borrow"
52+
| "repay"
53+
| "withdraw"
54+
| "depositVault"
55+
| "withdrawVault"
56+
| "supplySmartDexLp"
57+
| "supplySmartCollateral"
58+
| "withdrawSmartDexLp"
59+
| "withdrawSmartCollateral"
60+
| "withdrawSmartCollateralFixed"
61+
| "repaySmartMarket"
62+
| "brokerBorrow"
63+
| "brokerRepay";
4964
params: {
5065
to: Address;
5166
abi: Abi;
5267
functionName: string;
53-
args: unknown[];
68+
args: readonly unknown[];
5469
value?: bigint;
70+
chainId: ChainId;
71+
data: `0x${string}`;
72+
};
73+
meta?: {
74+
token?: Address;
75+
spender?: Address;
76+
amount?: bigint;
77+
reset?: boolean;
5578
};
5679
}
5780
```

packages/moolah-lending-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lista-dao/moolah-lending-sdk",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"type": "module",
55
"main": "./dist/index.js",
66
"module": "./dist/index.js",

packages/moolah-sdk-core/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @lista-dao/moolah-sdk-core
22

3+
## 1.0.1
4+
5+
### Patch Changes
6+
7+
- Update readme files
8+
39
## 1.0.0
410

511
### Major Changes

packages/moolah-sdk-core/README.md

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ const amount = Decimal.parse("123.456", 18);
3333
amount.add(10).mul(2).div(3);
3434

3535
// Rounding
36-
amount.dp(2, RoundingMode.ROUND); // 123.46
36+
amount.dp(2, RoundingMode.ROUND); // 123.46
3737

3838
// Format
39-
amount.toString(2); // "123.46" (trims zeros)
40-
amount.toFixed(4); // "123.4560"
41-
amount.toFormat(2); // "123.46" (with commas for large numbers)
39+
amount.toString(2); // "123.46" (trims zeros)
40+
amount.toFixed(4); // "123.4560"
41+
amount.toFormat(2); // "123.46" (with commas for large numbers)
4242

4343
// Comparison
44-
amount.gt(100); // true
44+
amount.gt(100); // true
4545
amount.eq(123.456); // true
4646
```
4747

@@ -60,8 +60,8 @@ import {
6060

6161
// Calculate current LTV
6262
const ltv = computeLTV({
63-
collateral: 1000000000000000000n, // 1 ETH collateral
64-
borrowed: 500000000n, // 500 USDC borrowed
63+
collateral: 1000000000000000000n, // 1 ETH collateral
64+
borrowed: 500000000n, // 500 USDC borrowed
6565
priceRate: 2000000000000000000000n, // ETH = 2000 USDC
6666
});
6767

@@ -70,9 +70,9 @@ const result = simulateBorrow({
7070
collateral: 1000000000000000000n,
7171
borrowed: 0n,
7272
priceRate: 2000000000000000000000n,
73-
lltv: 800000000000000000n, // 80% LLTV
74-
supplyAmount: 500000000000000000n, // Adding 0.5 ETH
75-
borrowAmount: 500000000n, // Borrowing 500 USDC
73+
lltv: 800000000000000000n, // 80% LLTV
74+
supplyAmount: 500000000000000000n, // Adding 0.5 ETH
75+
borrowAmount: 500000000n, // Borrowing 500 USDC
7676
});
7777
// result: { newLTV, newLiqPrice, newLoanable, newWithdrawable, ... }
7878
```
@@ -107,24 +107,32 @@ const curve = getInterestRates({
107107
});
108108
```
109109

110-
### Vault Calculations
110+
### Vault Simulation
111111

112112
```typescript
113113
import {
114114
simulateVaultDeposit,
115115
simulateVaultWithdraw,
116-
getVaultSharePrice,
117-
convertToShares,
118-
convertToAssets,
116+
Decimal,
119117
} from "@lista-dao/moolah-sdk-core";
120118

121-
// Simulate vault deposit
122-
const result = simulateVaultDeposit({
123-
totalAssets,
124-
totalSupply,
125-
assets: depositAmount,
119+
// Simulate vault deposit (user balance → locked in vault)
120+
const depositResult = simulateVaultDeposit({
121+
depositAmount: Decimal.parse("100", 18),
122+
userLocked: Decimal.parse("500", 18),
123+
userBalance: Decimal.parse("1000", 18),
124+
apy: Decimal.parse("0.05", 18), // optional, for earnings projection
125+
assetPrice: Decimal.parse("1", 18), // optional
126126
});
127-
// result: { shares, newTotalAssets, newTotalSupply }
127+
// depositResult: { locked, balance, yearlyEarnings?, monthlyEarnings? }
128+
129+
// Simulate vault withdraw
130+
const withdrawResult = simulateVaultWithdraw({
131+
withdrawAmount: Decimal.parse("100", 18),
132+
userLocked: Decimal.parse("500", 18),
133+
userBalance: Decimal.parse("200", 18),
134+
});
135+
// withdrawResult: { locked, balance, yearlyEarnings?, monthlyEarnings? }
128136
```
129137

130138
### Loan Calculations
@@ -149,7 +157,7 @@ const repayment = calculateFixedLoanRepayment({
149157
```typescript
150158
import type {
151159
// Network
152-
NetworkName, // 'bsc' | 'ethereum' | 'sepolia'
160+
NetworkName, // 'bsc' | 'ethereum'
153161

154162
// Tokens
155163
TokenInfo,
@@ -168,8 +176,9 @@ import type {
168176
WriteSmartMarketConfig,
169177

170178
// Broker
171-
BrokerUserPosition,
172-
BrokerFixedTerm,
179+
BrokerUserPositionsData,
180+
FixedTermAndRate,
181+
BrokerInfo,
173182

174183
// Operations
175184
BuiltSupplyOperation,
@@ -183,14 +192,10 @@ import type {
183192

184193
```typescript
185194
import {
186-
// ABIs
187-
moolahAbi,
188-
moolahVaultAbi,
189-
interestRateModelAbi,
190-
erc20Abi,
191-
erc4626Abi,
192-
193-
// Address helpers
195+
MOOLAH_ABI,
196+
MOOLAH_VAULT_ABI,
197+
INTEREST_RATE_MODEL_ABI,
198+
ERC20_ABI,
194199
getContractAddress,
195200
getContractAddressOptional,
196201
} from "@lista-dao/moolah-sdk-core";
@@ -209,11 +214,11 @@ import {
209214
isUsdtLikeToken,
210215
} from "@lista-dao/moolah-sdk-core";
211216

212-
// Get API chain identifier
213-
const apiChain = getApiChain("bsc"); // "BSC"
217+
// Get API chain identifier (for list APIs)
218+
const apiChain = getApiChain("bsc"); // "bsc"
214219

215220
// Get API URL
216-
const url = getListaApiUrl("prod"); // "https://api.lista.org"
221+
const url = getListaApiUrl("prod"); // "https://api.lista.org"
217222
```
218223

219224
## Package Architecture
@@ -227,22 +232,28 @@ This is a **zero-dependency core package** (except for Morpho SDK for interest c
227232
```
228233
moolah-sdk-core/
229234
├── calculations/
230-
│ ├── position.ts # LTV, loanable, withdrawable
235+
│ ├── position.ts # LTV, loanable, withdrawable (bigint)
231236
│ ├── interestRate.ts # Borrow rates, APY
232-
│ ├── vault.ts # Vault share calculations
233-
│ └── loan.ts # Loan repayment calculations
237+
│ ├── stablepool.ts # Stable swap / LP math
238+
│ └── loan.ts # Loan repayment calculations
239+
├── simulate/
240+
│ ├── market.ts # simulateMarketBorrow, simulateMarketRepay
241+
│ ├── vault.ts # simulateVaultDeposit, simulateVaultWithdraw
242+
│ └── smart.ts # Smart market simulate + LP breakdown
234243
├── contracts/
235-
│ ├── abi/ # Contract ABIs
236-
│ └── config.ts # Contract addresses
244+
│ ├── abis/ # Contract ABIs
245+
│ └── config.ts # Contract addresses
237246
├── types/
238-
│ ├── market.ts # Market types
239-
│ ├── vault.ts # Vault types
240-
│ ├── loan.ts # Loan types
241-
│ └── operations.ts # Operation result types
247+
│ ├── market.ts # Market types
248+
│ ├── vault.ts # Vault types
249+
│ ├── smart.ts # Smart market types
250+
│ ├── broker.ts # Broker types
251+
│ └── operations.ts # Operation result types
242252
└── utils/
243-
├── decimal.ts # Decimal class
253+
├── decimal.ts # Decimal class
244254
├── fraction.ts # Fraction class
245-
└── network.ts # Network helpers
255+
├── apiChain.ts # getApiChain, getListaApiUrl
256+
└── network.ts # getNativeCurrencySymbol
246257
```
247258

248259
## License

packages/moolah-sdk-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lista-dao/moolah-sdk-core",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"type": "module",
55
"main": "./dist/index.js",
66
"module": "./dist/index.js",

0 commit comments

Comments
 (0)