@indigo-labs/indigo-sdk 0.1.7 → 0.1.9
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/.github/workflows/ci.yml +62 -0
- package/.github/workflows/test.yml +44 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.prettierrc +6 -0
- package/dist/index.d.mts +19 -9
- package/dist/index.d.ts +19 -9
- package/dist/index.js +341 -315
- package/dist/index.mjs +92 -64
- package/eslint.config.mjs +36 -0
- package/package.json +2 -6
- package/src/contracts/cdp.ts +748 -0
- package/src/contracts/collector.ts +98 -0
- package/src/contracts/gov.ts +1 -0
- package/src/contracts/interest-oracle.ts +149 -0
- package/src/contracts/lrp.ts +308 -0
- package/src/contracts/one-shot.ts +67 -0
- package/src/contracts/stability-pool.ts +684 -0
- package/src/contracts/staking.ts +348 -0
- package/src/contracts/treasury.ts +112 -0
- package/src/helpers/asset-helpers.ts +57 -0
- package/src/helpers/helper-txs.ts +30 -0
- package/src/helpers/helpers.ts +38 -0
- package/src/helpers/indigo-helpers.ts +19 -0
- package/src/helpers/interest-oracle.ts +57 -0
- package/src/helpers/lucid-utils.ts +70 -0
- package/src/helpers/price-oracle-helpers.ts +36 -0
- package/src/helpers/stability-pool-helpers.ts +207 -0
- package/src/helpers/staking-helpers.ts +94 -0
- package/src/helpers/time-helpers.ts +4 -0
- package/src/helpers/value-helpers.ts +27 -0
- package/src/index.ts +34 -0
- package/src/scripts/always-fail-validator.ts +7 -0
- package/src/scripts/auth-token-policy.ts +23 -0
- package/src/scripts/cdp-creator-validator.ts +53 -0
- package/src/scripts/cdp-validator.ts +9 -0
- package/src/scripts/collector-validator.ts +8 -0
- package/src/scripts/execute-validator.ts +52 -0
- package/src/scripts/gov-validator.ts +44 -0
- package/src/scripts/iasset-policy.ts +22 -0
- package/src/scripts/interest-oracle-validator.ts +23 -0
- package/src/scripts/lrp-validator.ts +40 -0
- package/src/scripts/one-shot-policy.ts +62 -0
- package/src/scripts/poll-manager-validator.ts +52 -0
- package/src/scripts/poll-shard-validator.ts +47 -0
- package/src/scripts/price-oracle-validator.ts +26 -0
- package/src/scripts/stability-pool-validator.ts +60 -0
- package/src/scripts/staking-validator.ts +8 -0
- package/src/scripts/treasury-validator.ts +8 -0
- package/src/scripts/version-record-policy.ts +26 -0
- package/src/scripts/version-registry.ts +15 -0
- package/src/types/generic.ts +106 -0
- package/src/types/indigo/cdp-creator.ts +46 -0
- package/src/types/indigo/cdp.ts +88 -0
- package/src/types/indigo/execute.ts +21 -0
- package/src/types/indigo/gov.ts +51 -0
- package/src/types/indigo/interest-oracle.ts +55 -0
- package/src/types/indigo/lrp.ts +59 -0
- package/src/types/indigo/poll-manager.ts +21 -0
- package/src/types/indigo/poll-shard.ts +16 -0
- package/src/types/indigo/price-oracle.ts +38 -0
- package/src/types/indigo/stability-pool.ts +233 -0
- package/src/types/indigo/staking.ts +99 -0
- package/src/types/indigo/version-record.ts +17 -0
- package/src/types/on-chain-decimal.ts +23 -0
- package/src/types/one-shot.ts +22 -0
- package/src/types/system-params.ts +256 -0
- package/tests/data/system-params.json +1012 -0
- package/tests/datums.test.ts +286 -0
- package/tests/endpoints/initialize.ts +1013 -0
- package/tests/hash-checks.test.ts +80 -0
- package/tests/indigo-test-helpers.ts +115 -0
- package/tests/initialize.test.ts +27 -0
- package/tests/interest-calculations.test.ts +120 -0
- package/tests/interest-oracle.test.ts +90 -0
- package/tests/lrp.test.ts +769 -0
- package/tests/queries/governance-queries.ts +31 -0
- package/tests/queries/iasset-queries.ts +39 -0
- package/tests/queries/interest-oracle-queries.ts +13 -0
- package/tests/queries/lrp-queries.ts +39 -0
- package/tests/queries/price-oracle-queries.ts +27 -0
- package/tests/queries/stability-pool-queries.ts +75 -0
- package/tests/queries/staking-queries.ts +43 -0
- package/tests/stability-pool.test.ts +387 -0
- package/tests/staking.test.ts +105 -0
- package/tests/test-helpers.ts +38 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +17 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: '.nvmrc'
|
|
21
|
+
|
|
22
|
+
- name: Setup pnpm
|
|
23
|
+
uses: pnpm/action-setup@v4
|
|
24
|
+
with:
|
|
25
|
+
version: latest
|
|
26
|
+
|
|
27
|
+
- name: Get pnpm store directory
|
|
28
|
+
shell: bash
|
|
29
|
+
run: |
|
|
30
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
31
|
+
|
|
32
|
+
- name: Setup pnpm cache
|
|
33
|
+
uses: actions/cache@v4
|
|
34
|
+
with:
|
|
35
|
+
path: ${{ env.STORE_PATH }}
|
|
36
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
37
|
+
restore-keys: |
|
|
38
|
+
${{ runner.os }}-pnpm-store-
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: pnpm install --frozen-lockfile
|
|
42
|
+
|
|
43
|
+
- name: Check formatting
|
|
44
|
+
run: pnpm run format:check
|
|
45
|
+
|
|
46
|
+
- name: Check linting
|
|
47
|
+
run: pnpm run lint
|
|
48
|
+
|
|
49
|
+
- name: Build project
|
|
50
|
+
run: pnpm run build
|
|
51
|
+
|
|
52
|
+
- name: Verify build output
|
|
53
|
+
run: |
|
|
54
|
+
if [ ! -d "dist" ]; then
|
|
55
|
+
echo "Build failed: dist directory not found"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
if [ ! -f "dist/index.js" ] || [ ! -f "dist/index.mjs" ] || [ ! -f "dist/index.d.ts" ]; then
|
|
59
|
+
echo "Build failed: expected output files not found"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
echo "Build verification passed"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: '.nvmrc'
|
|
21
|
+
|
|
22
|
+
- name: Setup pnpm
|
|
23
|
+
uses: pnpm/action-setup@v4
|
|
24
|
+
with:
|
|
25
|
+
version: latest
|
|
26
|
+
|
|
27
|
+
- name: Get pnpm store directory
|
|
28
|
+
shell: bash
|
|
29
|
+
run: |
|
|
30
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
31
|
+
|
|
32
|
+
- name: Setup pnpm cache
|
|
33
|
+
uses: actions/cache@v4
|
|
34
|
+
with:
|
|
35
|
+
path: ${{ env.STORE_PATH }}
|
|
36
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
37
|
+
restore-keys: |
|
|
38
|
+
${{ runner.os }}-pnpm-store-
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: pnpm install --frozen-lockfile
|
|
42
|
+
|
|
43
|
+
- name: Run tests
|
|
44
|
+
run: pnpm run test
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm exec lint-staged
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v18.19.1
|
package/.prettierrc
ADDED
package/dist/index.d.mts
CHANGED
|
@@ -67,6 +67,7 @@ interface SystemParams {
|
|
|
67
67
|
scriptReferences: ScriptReferences;
|
|
68
68
|
pollShardParams: PollShardParamsSP;
|
|
69
69
|
pollManagerParams: PollManagerParamsSP;
|
|
70
|
+
lrpParams: LrpParamsSP;
|
|
70
71
|
indyToken: AssetClassSP;
|
|
71
72
|
govParams: GovParamsSP;
|
|
72
73
|
executeParams: ExecuteParamsSP;
|
|
@@ -82,6 +83,7 @@ type ValidatorHashes = {
|
|
|
82
83
|
stabilityPoolHash: string;
|
|
83
84
|
pollShardHash: string;
|
|
84
85
|
pollManagerHash: string;
|
|
86
|
+
lrpHash: string;
|
|
85
87
|
govHash: string;
|
|
86
88
|
executeHash: string;
|
|
87
89
|
collectorHash: string;
|
|
@@ -145,6 +147,7 @@ interface ScriptReferences {
|
|
|
145
147
|
stabilityPoolValidatorRef: ScriptReference;
|
|
146
148
|
pollShardValidatorRef: ScriptReference;
|
|
147
149
|
pollManagerValidatorRef: ScriptReference;
|
|
150
|
+
lrpValidatorRef: ScriptReference;
|
|
148
151
|
liquidityValidatorRef: ScriptReference;
|
|
149
152
|
iAssetTokenPolicyRef: ScriptReference;
|
|
150
153
|
governanceValidatorRef: ScriptReference;
|
|
@@ -197,6 +200,12 @@ interface AuthTokenPolicies {
|
|
|
197
200
|
cdpAuthTokenRef: ScriptReference;
|
|
198
201
|
accountTokenRef: ScriptReference;
|
|
199
202
|
}
|
|
203
|
+
interface LrpParamsSP {
|
|
204
|
+
versionRecordToken: AssetClassSP;
|
|
205
|
+
iassetNft: AssetClassSP;
|
|
206
|
+
iassetPolicyId: CurrencySymbol;
|
|
207
|
+
minRedemptionLovelacesAmt: bigint;
|
|
208
|
+
}
|
|
200
209
|
interface PollShardParamsSP {
|
|
201
210
|
stakingValHash: string;
|
|
202
211
|
stakingToken: AssetClassSP;
|
|
@@ -277,13 +286,13 @@ declare function toSystemParamsAsset(asset: AssetClass): AssetClassSP;
|
|
|
277
286
|
declare function fromSystemParamsAsset(asset: AssetClassSP): AssetClass;
|
|
278
287
|
|
|
279
288
|
declare class CDPContract {
|
|
280
|
-
static openPosition(asset: string, collateralAmount: bigint, mintedAmount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, cdpCreatorRef?: OutRef, collectorRef?: OutRef
|
|
281
|
-
static deposit(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
282
|
-
static withdraw(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
283
|
-
static mint(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
284
|
-
static burn(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
285
|
-
static adjust(cdpRef: OutRef, collateralAmount: bigint, mintAmount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
286
|
-
static close(cdpRef: OutRef, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
289
|
+
static openPosition(asset: string, collateralAmount: bigint, mintedAmount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, cdpCreatorRef?: OutRef, collectorRef?: OutRef): Promise<TxBuilder>;
|
|
290
|
+
static deposit(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
291
|
+
static withdraw(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
292
|
+
static mint(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
293
|
+
static burn(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
294
|
+
static adjust(cdpRef: OutRef, collateralAmount: bigint, mintAmount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
295
|
+
static close(cdpRef: OutRef, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
287
296
|
static validator(params: CdpParams): SpendingValidator;
|
|
288
297
|
static validatorHash(params: CdpParams): string;
|
|
289
298
|
static address(cdpParams: CdpParams, lucid: LucidEvolution, skh?: Credential$1): string;
|
|
@@ -1280,7 +1289,7 @@ declare function openLrp(assetTokenName: string, lovelacesAmt: bigint, maxPrice:
|
|
|
1280
1289
|
declare function cancelLrp(lrpOutRef: OutRef, lrpRefScriptOutRef: OutRef, lucid: LucidEvolution): Promise<TxBuilder>;
|
|
1281
1290
|
declare function redeemLrp(
|
|
1282
1291
|
/** The tuple represents the LRP outref and the amount of iAssets to redeem against it. */
|
|
1283
|
-
redemptionLrpsData: [OutRef, bigint][], lrpRefScriptOutRef: OutRef, priceOracleOutRef: OutRef, iassetOutRef: OutRef, lucid: LucidEvolution, lrpParams: LRPParams,
|
|
1292
|
+
redemptionLrpsData: [OutRef, bigint][], lrpRefScriptOutRef: OutRef, priceOracleOutRef: OutRef, iassetOutRef: OutRef, lucid: LucidEvolution, lrpParams: LRPParams, network: Network): Promise<TxBuilder>;
|
|
1284
1293
|
/**
|
|
1285
1294
|
* Create Tx adjusting the LRP and claiming the received iAssets
|
|
1286
1295
|
*/
|
|
@@ -1296,6 +1305,7 @@ lovelacesAdjustAmt: bigint, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): P
|
|
|
1296
1305
|
declare function claimLrp(lucid: LucidEvolution, lrpOutRef: OutRef, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): Promise<TxBuilder>;
|
|
1297
1306
|
|
|
1298
1307
|
declare const mkLrpValidator: (params: LRPParams) => SpendingValidator;
|
|
1308
|
+
declare const mkLrpValidatorFromSP: (params: LrpParamsSP) => SpendingValidator;
|
|
1299
1309
|
|
|
1300
1310
|
/**
|
|
1301
1311
|
* Uses an always fail validator for the destination address.
|
|
@@ -1317,4 +1327,4 @@ type OneShotParams = Data.Static<typeof OneShotParamsSchema>;
|
|
|
1317
1327
|
declare function oneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<[TxBuilder, PolicyId]>;
|
|
1318
1328
|
declare function runOneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<PolicyId>;
|
|
1319
1329
|
|
|
1320
|
-
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
|
1330
|
+
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpParamsSP, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ interface SystemParams {
|
|
|
67
67
|
scriptReferences: ScriptReferences;
|
|
68
68
|
pollShardParams: PollShardParamsSP;
|
|
69
69
|
pollManagerParams: PollManagerParamsSP;
|
|
70
|
+
lrpParams: LrpParamsSP;
|
|
70
71
|
indyToken: AssetClassSP;
|
|
71
72
|
govParams: GovParamsSP;
|
|
72
73
|
executeParams: ExecuteParamsSP;
|
|
@@ -82,6 +83,7 @@ type ValidatorHashes = {
|
|
|
82
83
|
stabilityPoolHash: string;
|
|
83
84
|
pollShardHash: string;
|
|
84
85
|
pollManagerHash: string;
|
|
86
|
+
lrpHash: string;
|
|
85
87
|
govHash: string;
|
|
86
88
|
executeHash: string;
|
|
87
89
|
collectorHash: string;
|
|
@@ -145,6 +147,7 @@ interface ScriptReferences {
|
|
|
145
147
|
stabilityPoolValidatorRef: ScriptReference;
|
|
146
148
|
pollShardValidatorRef: ScriptReference;
|
|
147
149
|
pollManagerValidatorRef: ScriptReference;
|
|
150
|
+
lrpValidatorRef: ScriptReference;
|
|
148
151
|
liquidityValidatorRef: ScriptReference;
|
|
149
152
|
iAssetTokenPolicyRef: ScriptReference;
|
|
150
153
|
governanceValidatorRef: ScriptReference;
|
|
@@ -197,6 +200,12 @@ interface AuthTokenPolicies {
|
|
|
197
200
|
cdpAuthTokenRef: ScriptReference;
|
|
198
201
|
accountTokenRef: ScriptReference;
|
|
199
202
|
}
|
|
203
|
+
interface LrpParamsSP {
|
|
204
|
+
versionRecordToken: AssetClassSP;
|
|
205
|
+
iassetNft: AssetClassSP;
|
|
206
|
+
iassetPolicyId: CurrencySymbol;
|
|
207
|
+
minRedemptionLovelacesAmt: bigint;
|
|
208
|
+
}
|
|
200
209
|
interface PollShardParamsSP {
|
|
201
210
|
stakingValHash: string;
|
|
202
211
|
stakingToken: AssetClassSP;
|
|
@@ -277,13 +286,13 @@ declare function toSystemParamsAsset(asset: AssetClass): AssetClassSP;
|
|
|
277
286
|
declare function fromSystemParamsAsset(asset: AssetClassSP): AssetClass;
|
|
278
287
|
|
|
279
288
|
declare class CDPContract {
|
|
280
|
-
static openPosition(asset: string, collateralAmount: bigint, mintedAmount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, cdpCreatorRef?: OutRef, collectorRef?: OutRef
|
|
281
|
-
static deposit(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
282
|
-
static withdraw(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
283
|
-
static mint(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
284
|
-
static burn(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
285
|
-
static adjust(cdpRef: OutRef, collateralAmount: bigint, mintAmount: bigint, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
286
|
-
static close(cdpRef: OutRef, params: SystemParams, lucid: LucidEvolution, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
289
|
+
static openPosition(asset: string, collateralAmount: bigint, mintedAmount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, cdpCreatorRef?: OutRef, collectorRef?: OutRef): Promise<TxBuilder>;
|
|
290
|
+
static deposit(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
291
|
+
static withdraw(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
292
|
+
static mint(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
293
|
+
static burn(cdpRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
294
|
+
static adjust(cdpRef: OutRef, collateralAmount: bigint, mintAmount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
295
|
+
static close(cdpRef: OutRef, params: SystemParams, lucid: LucidEvolution, currentSlot: number, assetRef?: OutRef, priceOracleRef?: OutRef, interestOracleRef?: OutRef, collectorRef?: OutRef, govRef?: OutRef, treasuryRef?: OutRef): Promise<TxBuilder>;
|
|
287
296
|
static validator(params: CdpParams): SpendingValidator;
|
|
288
297
|
static validatorHash(params: CdpParams): string;
|
|
289
298
|
static address(cdpParams: CdpParams, lucid: LucidEvolution, skh?: Credential$1): string;
|
|
@@ -1280,7 +1289,7 @@ declare function openLrp(assetTokenName: string, lovelacesAmt: bigint, maxPrice:
|
|
|
1280
1289
|
declare function cancelLrp(lrpOutRef: OutRef, lrpRefScriptOutRef: OutRef, lucid: LucidEvolution): Promise<TxBuilder>;
|
|
1281
1290
|
declare function redeemLrp(
|
|
1282
1291
|
/** The tuple represents the LRP outref and the amount of iAssets to redeem against it. */
|
|
1283
|
-
redemptionLrpsData: [OutRef, bigint][], lrpRefScriptOutRef: OutRef, priceOracleOutRef: OutRef, iassetOutRef: OutRef, lucid: LucidEvolution, lrpParams: LRPParams,
|
|
1292
|
+
redemptionLrpsData: [OutRef, bigint][], lrpRefScriptOutRef: OutRef, priceOracleOutRef: OutRef, iassetOutRef: OutRef, lucid: LucidEvolution, lrpParams: LRPParams, network: Network): Promise<TxBuilder>;
|
|
1284
1293
|
/**
|
|
1285
1294
|
* Create Tx adjusting the LRP and claiming the received iAssets
|
|
1286
1295
|
*/
|
|
@@ -1296,6 +1305,7 @@ lovelacesAdjustAmt: bigint, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): P
|
|
|
1296
1305
|
declare function claimLrp(lucid: LucidEvolution, lrpOutRef: OutRef, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): Promise<TxBuilder>;
|
|
1297
1306
|
|
|
1298
1307
|
declare const mkLrpValidator: (params: LRPParams) => SpendingValidator;
|
|
1308
|
+
declare const mkLrpValidatorFromSP: (params: LrpParamsSP) => SpendingValidator;
|
|
1299
1309
|
|
|
1300
1310
|
/**
|
|
1301
1311
|
* Uses an always fail validator for the destination address.
|
|
@@ -1317,4 +1327,4 @@ type OneShotParams = Data.Static<typeof OneShotParamsSchema>;
|
|
|
1317
1327
|
declare function oneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<[TxBuilder, PolicyId]>;
|
|
1318
1328
|
declare function runOneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<PolicyId>;
|
|
1319
1329
|
|
|
1320
|
-
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
|
1330
|
+
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpParamsSP, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|