@gvnrdao/dh-sdk 0.0.277 → 0.0.279
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/browser/dist/browser.js +1 -1
- package/dist/index.js +100 -90
- package/dist/index.mjs +100 -90
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -31364,160 +31364,160 @@ var require_pkg_src = __commonJS({
|
|
|
31364
31364
|
hash: "d6eb8665fa4f1fe19b6a2bc81fbf729af68a1daf30117f40e37705381978a7ce"
|
|
31365
31365
|
},
|
|
31366
31366
|
pkpValidator: {
|
|
31367
|
-
cid: "
|
|
31367
|
+
cid: "QmRAueBjNG78qA79x4NL4ogfNg7e6j6DiEGenEN4S3BSGg",
|
|
31368
31368
|
authorizedCidHex: cidToHex(
|
|
31369
|
-
"
|
|
31369
|
+
"QmRAueBjNG78qA79x4NL4ogfNg7e6j6DiEGenEN4S3BSGg"
|
|
31370
31370
|
),
|
|
31371
31371
|
name: "Pkp Validator",
|
|
31372
31372
|
description: "Production Pkp Validator",
|
|
31373
31373
|
version: "1.0.0",
|
|
31374
31374
|
deployed: true,
|
|
31375
|
-
deployedAt:
|
|
31376
|
-
size:
|
|
31377
|
-
hash: "
|
|
31378
|
-
validatorWalletAddress: "
|
|
31375
|
+
deployedAt: 1781116572961,
|
|
31376
|
+
size: 4110,
|
|
31377
|
+
hash: "c3b121afcdc0d7d7ed7ca3be5b185fc502ffad99bf83cdf166769bbfa5194687",
|
|
31378
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31379
31379
|
pkp: {
|
|
31380
31380
|
publicKey: "0x04ec0e3acc40884e3f366ca469d08899eb640ad5259fa196b0238075086208a9f8732a3175704f35f0bcc28e07406cfb24c254efd1e7355640577330f0d2dd755f",
|
|
31381
|
-
ethAddress: "
|
|
31381
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31382
31382
|
}
|
|
31383
31383
|
},
|
|
31384
31384
|
btcTransactionSigner: {
|
|
31385
|
-
cid: "
|
|
31385
|
+
cid: "QmTrtAnUFpAi6tpw74UPCiULqe9Z4SBE4b4neekY8evK5Y",
|
|
31386
31386
|
authorizedCidHex: cidToHex(
|
|
31387
|
-
"
|
|
31387
|
+
"QmTrtAnUFpAi6tpw74UPCiULqe9Z4SBE4b4neekY8evK5Y"
|
|
31388
31388
|
),
|
|
31389
31389
|
name: "Btc Transaction Signer",
|
|
31390
31390
|
description: "Production Btc Transaction Signer",
|
|
31391
31391
|
version: "1.0.0",
|
|
31392
31392
|
deployed: true,
|
|
31393
|
-
deployedAt:
|
|
31394
|
-
size:
|
|
31395
|
-
hash: "
|
|
31393
|
+
deployedAt: 1780976122896,
|
|
31394
|
+
size: 41048,
|
|
31395
|
+
hash: "93725b2020e1914e93f1e21bdcc75d9cb28bc0b6bc4ea9b470f112e1f068998f"
|
|
31396
31396
|
},
|
|
31397
31397
|
ucdMintValidator: {
|
|
31398
|
-
cid: "
|
|
31398
|
+
cid: "QmTWKgfSHfYWTosPJBzu2s4sM2U6qhvmA9pXbkUzDxdQTJ",
|
|
31399
31399
|
authorizedCidHex: cidToHex(
|
|
31400
|
-
"
|
|
31400
|
+
"QmTWKgfSHfYWTosPJBzu2s4sM2U6qhvmA9pXbkUzDxdQTJ"
|
|
31401
31401
|
),
|
|
31402
31402
|
name: "Ucd Mint Validator",
|
|
31403
31403
|
description: "Production Ucd Mint Validator",
|
|
31404
31404
|
version: "1.0.0",
|
|
31405
31405
|
deployed: true,
|
|
31406
|
-
deployedAt:
|
|
31407
|
-
size:
|
|
31408
|
-
hash: "
|
|
31409
|
-
validatorWalletAddress: "
|
|
31406
|
+
deployedAt: 1781116591564,
|
|
31407
|
+
size: 68521,
|
|
31408
|
+
hash: "5a955863b32c003314ab29c37b157e06d00a2f93c2d9085a02ca73b71838a72f",
|
|
31409
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31410
31410
|
pkp: {
|
|
31411
31411
|
publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
|
|
31412
|
-
ethAddress: "
|
|
31412
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31413
31413
|
}
|
|
31414
31414
|
},
|
|
31415
31415
|
processPaymentValidator: {
|
|
31416
|
-
cid: "
|
|
31416
|
+
cid: "QmVJ9UaUz8vfvHCEwVY584e9RTEcqy3f3T89UNtzzFSdcz",
|
|
31417
31417
|
authorizedCidHex: cidToHex(
|
|
31418
|
-
"
|
|
31418
|
+
"QmVJ9UaUz8vfvHCEwVY584e9RTEcqy3f3T89UNtzzFSdcz"
|
|
31419
31419
|
),
|
|
31420
31420
|
name: "Process Payment Validator",
|
|
31421
31421
|
description: "Production Process Payment Validator",
|
|
31422
31422
|
version: "1.0.0",
|
|
31423
31423
|
deployed: true,
|
|
31424
|
-
deployedAt:
|
|
31425
|
-
size:
|
|
31426
|
-
hash: "
|
|
31427
|
-
validatorWalletAddress: "
|
|
31424
|
+
deployedAt: 1780976120346,
|
|
31425
|
+
size: 64473,
|
|
31426
|
+
hash: "8cf2ea8e2bf39ab02c6ac1706d8bec2aa16aa1f04f4789b11fa8215e04ac2d7e",
|
|
31427
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31428
31428
|
pkp: {
|
|
31429
31429
|
publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
|
|
31430
|
-
ethAddress: "
|
|
31430
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31431
31431
|
}
|
|
31432
31432
|
},
|
|
31433
31433
|
extendPositionValidator: {
|
|
31434
|
-
cid: "
|
|
31434
|
+
cid: "QmW2zjWbsVzm8q4oMEHZ1SCeijygZFMvvi9zHqUQWm3jut",
|
|
31435
31435
|
authorizedCidHex: cidToHex(
|
|
31436
|
-
"
|
|
31436
|
+
"QmW2zjWbsVzm8q4oMEHZ1SCeijygZFMvvi9zHqUQWm3jut"
|
|
31437
31437
|
),
|
|
31438
31438
|
name: "Extend Position Validator",
|
|
31439
31439
|
description: "Production Extend Position Validator",
|
|
31440
31440
|
version: "1.0.1",
|
|
31441
31441
|
deployed: true,
|
|
31442
|
-
deployedAt:
|
|
31443
|
-
size:
|
|
31444
|
-
hash: "
|
|
31445
|
-
validatorWalletAddress: "
|
|
31442
|
+
deployedAt: 1781116610064,
|
|
31443
|
+
size: 63508,
|
|
31444
|
+
hash: "187c71046858bde0753fe479634bd2901e3d7f3689b5f39a82b3c5fa3a47b53d",
|
|
31445
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31446
31446
|
pkp: {
|
|
31447
31447
|
publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
|
|
31448
|
-
ethAddress: "
|
|
31448
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31449
31449
|
}
|
|
31450
31450
|
},
|
|
31451
31451
|
btcWithdrawal: {
|
|
31452
|
-
cid: "
|
|
31452
|
+
cid: "QmcxHLCcXpx5Jstd1hQmwjU2KPDzP2KYEdMgbZVn84nY6n",
|
|
31453
31453
|
authorizedCidHex: cidToHex(
|
|
31454
|
-
"
|
|
31454
|
+
"QmcxHLCcXpx5Jstd1hQmwjU2KPDzP2KYEdMgbZVn84nY6n"
|
|
31455
31455
|
),
|
|
31456
31456
|
name: "Btc Withdrawal",
|
|
31457
31457
|
description: "Production Btc Withdrawal",
|
|
31458
31458
|
version: "1.0.0",
|
|
31459
31459
|
deployed: true,
|
|
31460
|
-
deployedAt:
|
|
31461
|
-
size:
|
|
31462
|
-
hash: "
|
|
31463
|
-
validatorWalletAddress: "
|
|
31460
|
+
deployedAt: 1781116627244,
|
|
31461
|
+
size: 76218,
|
|
31462
|
+
hash: "1e686e517ab1b8163904a27d3e1962cecb2f49b3cc7ecdc8f2ff5e5847fe3762",
|
|
31463
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31464
31464
|
pkp: {
|
|
31465
31465
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
31466
|
-
ethAddress: "
|
|
31466
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31467
31467
|
}
|
|
31468
31468
|
},
|
|
31469
31469
|
liquidationValidator: {
|
|
31470
|
-
cid: "
|
|
31470
|
+
cid: "QmZv8cRhvQqEGscWufU4rYPrKNt3ruAhQWK2ei3ohJBiZA",
|
|
31471
31471
|
authorizedCidHex: cidToHex(
|
|
31472
|
-
"
|
|
31472
|
+
"QmZv8cRhvQqEGscWufU4rYPrKNt3ruAhQWK2ei3ohJBiZA"
|
|
31473
31473
|
),
|
|
31474
31474
|
name: "Liquidation Validator",
|
|
31475
31475
|
description: "Production Liquidation Validator",
|
|
31476
31476
|
version: "1.0.0",
|
|
31477
31477
|
deployed: true,
|
|
31478
|
-
deployedAt:
|
|
31479
|
-
size:
|
|
31480
|
-
hash: "
|
|
31481
|
-
validatorWalletAddress: "
|
|
31478
|
+
deployedAt: 1781116646357,
|
|
31479
|
+
size: 54901,
|
|
31480
|
+
hash: "017ec04899089b98991a5aab6eeae5e3214c2cc9de7ef9b3fc0cd5ad85c3556c",
|
|
31481
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31482
31482
|
pkp: {
|
|
31483
31483
|
publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
|
|
31484
|
-
ethAddress: "
|
|
31484
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31485
31485
|
}
|
|
31486
31486
|
},
|
|
31487
31487
|
priceOracle: {
|
|
31488
|
-
cid: "
|
|
31488
|
+
cid: "QmZwH2JzXpLPdtUiM52PLyfuCGphz82CCs54Y6fCbzxpri",
|
|
31489
31489
|
authorizedCidHex: cidToHex(
|
|
31490
|
-
"
|
|
31490
|
+
"QmZwH2JzXpLPdtUiM52PLyfuCGphz82CCs54Y6fCbzxpri"
|
|
31491
31491
|
),
|
|
31492
31492
|
name: "Price Oracle",
|
|
31493
31493
|
description: "Production Price Oracle (Chipotle main+getPrivateKey)",
|
|
31494
31494
|
version: "1.1.0",
|
|
31495
31495
|
deployed: true,
|
|
31496
|
-
deployedAt:
|
|
31497
|
-
size:
|
|
31498
|
-
hash: "
|
|
31499
|
-
validatorWalletAddress: "
|
|
31496
|
+
deployedAt: 1781116663270,
|
|
31497
|
+
size: 8695,
|
|
31498
|
+
hash: "ba20ade60a7fa5acd80dadfafa179c507388cfe6ce48a22a672d70b317ffcc74",
|
|
31499
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31500
31500
|
pkp: {
|
|
31501
31501
|
publicKey: "0x043beaa1da47875601a8d6f430b1438ee2d4732eefd06e5c63a474bbdaf9e7df1797b1b951e041b627c2bf839788164825324c9cbd1e2d6f740fdd4bff69b1900b",
|
|
31502
|
-
ethAddress: "
|
|
31502
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31503
31503
|
}
|
|
31504
31504
|
},
|
|
31505
31505
|
loanVaultBtcBalance: {
|
|
31506
|
-
cid: "
|
|
31506
|
+
cid: "Qmd7ZAWQzxjbFXjk39HuyRCN18FDG1LDifXceaikNFYRbm",
|
|
31507
31507
|
authorizedCidHex: cidToHex(
|
|
31508
|
-
"
|
|
31508
|
+
"Qmd7ZAWQzxjbFXjk39HuyRCN18FDG1LDifXceaikNFYRbm"
|
|
31509
31509
|
),
|
|
31510
31510
|
name: "Loan Vault Btc Balance",
|
|
31511
31511
|
description: "Production Loan Vault Btc Balance",
|
|
31512
31512
|
version: "1.0.0",
|
|
31513
31513
|
deployed: true,
|
|
31514
|
-
deployedAt:
|
|
31515
|
-
size:
|
|
31516
|
-
hash: "
|
|
31517
|
-
validatorWalletAddress: "
|
|
31514
|
+
deployedAt: 1780976125009,
|
|
31515
|
+
size: 44634,
|
|
31516
|
+
hash: "f7ba0f8778a15f349122237c44391800bb082d2090a87cc1631f0a764439d029",
|
|
31517
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31518
31518
|
pkp: {
|
|
31519
31519
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
31520
|
-
ethAddress: "
|
|
31520
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31521
31521
|
}
|
|
31522
31522
|
},
|
|
31523
31523
|
// btc-address-balance (Option B) — address-only signed total balance via
|
|
@@ -31527,21 +31527,21 @@ var require_pkg_src = __commonJS({
|
|
|
31527
31527
|
// Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
|
|
31528
31528
|
// on each target chain (the action decrypts registry slots). No OAR entry.
|
|
31529
31529
|
btcAddressBalance: {
|
|
31530
|
-
cid: "
|
|
31530
|
+
cid: "QmVmF9CHFDhhV51bNX87tVyd95oQS56u78ThFYKzMwEbFS",
|
|
31531
31531
|
authorizedCidHex: cidToHex(
|
|
31532
|
-
"
|
|
31532
|
+
"QmVmF9CHFDhhV51bNX87tVyd95oQS56u78ThFYKzMwEbFS"
|
|
31533
31533
|
),
|
|
31534
31534
|
name: "Btc Address Balance",
|
|
31535
31535
|
description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
|
|
31536
31536
|
version: "0.1.0",
|
|
31537
31537
|
deployed: true,
|
|
31538
|
-
deployedAt:
|
|
31539
|
-
size:
|
|
31540
|
-
hash: "
|
|
31541
|
-
validatorWalletAddress: "
|
|
31538
|
+
deployedAt: 1781116681558,
|
|
31539
|
+
size: 21957,
|
|
31540
|
+
hash: "b17977304be6b117bcb29feafc3bb654113d72d5147ceeba92e91b4d7f5c0327",
|
|
31541
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31542
31542
|
pkp: {
|
|
31543
31543
|
publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
|
|
31544
|
-
ethAddress: "
|
|
31544
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31545
31545
|
}
|
|
31546
31546
|
},
|
|
31547
31547
|
alwaysSigner: {
|
|
@@ -31571,21 +31571,21 @@ var require_pkg_src = __commonJS({
|
|
|
31571
31571
|
hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
|
|
31572
31572
|
},
|
|
31573
31573
|
staleSpendRecoveryValidator: {
|
|
31574
|
-
cid: "
|
|
31574
|
+
cid: "QmRZuRrxzsbp3WejuMfJJgws1iteRk87p1nGna82Cgun2k",
|
|
31575
31575
|
authorizedCidHex: cidToHex(
|
|
31576
|
-
"
|
|
31576
|
+
"QmRZuRrxzsbp3WejuMfJJgws1iteRk87p1nGna82Cgun2k"
|
|
31577
31577
|
),
|
|
31578
31578
|
name: "Stale Spend Recovery Validator",
|
|
31579
31579
|
description: "Production Stale Spend Recovery Validator",
|
|
31580
31580
|
version: "1.0.0",
|
|
31581
31581
|
deployed: true,
|
|
31582
|
-
deployedAt:
|
|
31583
|
-
size:
|
|
31584
|
-
hash: "
|
|
31585
|
-
validatorWalletAddress: "
|
|
31582
|
+
deployedAt: 1781116700324,
|
|
31583
|
+
size: 31148,
|
|
31584
|
+
hash: "c93591c7c7f51b519243499d78bd5ac0df1e368caa76c08d6a5d7aea9e3a49cc",
|
|
31585
|
+
validatorWalletAddress: "0x82db9f515957aa380b596c6ea2bd30cef181f236",
|
|
31586
31586
|
pkp: {
|
|
31587
31587
|
publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
|
|
31588
|
-
ethAddress: "
|
|
31588
|
+
ethAddress: "0xc7e1588Db94Bbe92Ab209B833235144Fc5b97607"
|
|
31589
31589
|
}
|
|
31590
31590
|
}
|
|
31591
31591
|
};
|
|
@@ -33865,6 +33865,10 @@ ${errorReport}`);
|
|
|
33865
33865
|
static {
|
|
33866
33866
|
this.REQUIRED_PROVIDER_COUNT = 3;
|
|
33867
33867
|
}
|
|
33868
|
+
/** Distinct providers required for the active mode: 1 in hardhat dev, else 3. */
|
|
33869
|
+
requiredCount() {
|
|
33870
|
+
return this.devSingleProvider ? 1 : _PriceOracleModule.REQUIRED_PROVIDER_COUNT;
|
|
33871
|
+
}
|
|
33868
33872
|
/**
|
|
33869
33873
|
* @param priceProvidersOrConfig - REQUIRED in production flows. An array of
|
|
33870
33874
|
* exactly 3 `{name, apiKey}` entries, one per locked provider. Every entry
|
|
@@ -33876,7 +33880,8 @@ ${errorReport}`);
|
|
|
33876
33880
|
* The strict count is still enforced (exactly 3).
|
|
33877
33881
|
* @param _mode - Ignored. Retained for backward-compatible call sites.
|
|
33878
33882
|
*/
|
|
33879
|
-
constructor(priceProvidersOrConfig, legacySources, _mode) {
|
|
33883
|
+
constructor(priceProvidersOrConfig, legacySources, _mode, opts) {
|
|
33884
|
+
this.devSingleProvider = opts?.devSingleProvider === true;
|
|
33880
33885
|
if (legacySources && Array.isArray(legacySources)) {
|
|
33881
33886
|
this.sources = legacySources;
|
|
33882
33887
|
} else {
|
|
@@ -33895,9 +33900,9 @@ ${errorReport}`);
|
|
|
33895
33900
|
* path flagged as H-2 in the audit. There is no "≥3" or "3 of N" mode.
|
|
33896
33901
|
*/
|
|
33897
33902
|
validateProviderCount() {
|
|
33898
|
-
if (this.sources.length !==
|
|
33903
|
+
if (this.sources.length !== this.requiredCount()) {
|
|
33899
33904
|
throw new Error(
|
|
33900
|
-
`Price oracle requires exactly ${
|
|
33905
|
+
`Price oracle requires exactly ${this.requiredCount()} provider(s). Currently configured: ${this.sources.length} provider(s). ` + (this.devSingleProvider ? "(hardhat dev single-provider mode)" : `Locked production set: ${_PriceOracleModule.ACTIVE_PROVIDER_NAMES.join(", ")}`)
|
|
33901
33906
|
);
|
|
33902
33907
|
}
|
|
33903
33908
|
}
|
|
@@ -33913,9 +33918,9 @@ ${errorReport}`);
|
|
|
33913
33918
|
* Throws as soon as any rule is violated.
|
|
33914
33919
|
*/
|
|
33915
33920
|
buildSources(priceProviders) {
|
|
33916
|
-
if (priceProviders.length !==
|
|
33921
|
+
if (priceProviders.length !== this.requiredCount()) {
|
|
33917
33922
|
throw new Error(
|
|
33918
|
-
`priceProviders must contain exactly ${
|
|
33923
|
+
`priceProviders must contain exactly ${this.requiredCount()} entr${this.requiredCount() === 1 ? "y" : "ies"}. Received: ${priceProviders.length}. ` + (this.devSingleProvider ? "(hardhat dev single-provider mode)" : `Locked production set: ${_PriceOracleModule.ACTIVE_PROVIDER_NAMES.join(", ")}`)
|
|
33919
33924
|
);
|
|
33920
33925
|
}
|
|
33921
33926
|
const sources = [];
|
|
@@ -34111,9 +34116,9 @@ ${errorReport}`);
|
|
|
34111
34116
|
*/
|
|
34112
34117
|
async getBTCPrice() {
|
|
34113
34118
|
const startTime = Date.now();
|
|
34114
|
-
if (this.sources.length !==
|
|
34119
|
+
if (this.sources.length !== this.requiredCount()) {
|
|
34115
34120
|
throw new Error(
|
|
34116
|
-
`Price oracle requires exactly ${
|
|
34121
|
+
`Price oracle requires exactly ${this.requiredCount()} provider(s). Currently configured: ${this.sources.length}`
|
|
34117
34122
|
);
|
|
34118
34123
|
}
|
|
34119
34124
|
const GLOBAL_TIMEOUT_MS = 8e3;
|
|
@@ -34142,14 +34147,19 @@ ${errorReport}`);
|
|
|
34142
34147
|
);
|
|
34143
34148
|
const prices = await Promise.race([fetchAll, timeoutPromise]);
|
|
34144
34149
|
const sorted = [...prices].sort((a, b2) => a - b2);
|
|
34145
|
-
|
|
34146
|
-
|
|
34147
|
-
|
|
34148
|
-
|
|
34149
|
-
|
|
34150
|
-
|
|
34151
|
-
|
|
34152
|
-
|
|
34150
|
+
let median;
|
|
34151
|
+
if (this.devSingleProvider) {
|
|
34152
|
+
median = sorted[0];
|
|
34153
|
+
} else {
|
|
34154
|
+
median = sorted[1];
|
|
34155
|
+
const spread = (sorted[2] - sorted[0]) / sorted[0];
|
|
34156
|
+
if (spread > PRICE_ORACLE_TOLERANCE) {
|
|
34157
|
+
const names2 = this.sources.map((s) => s.name).join(", ");
|
|
34158
|
+
const formatted = sorted.map((p) => `$${p.toLocaleString()}`).join(", ");
|
|
34159
|
+
throw new Error(
|
|
34160
|
+
`Price consensus failed: prices not within ${PRICE_ORACLE_TOLERANCE * 100}% tolerance. Providers: [${names2}]. Prices: [${formatted}]`
|
|
34161
|
+
);
|
|
34162
|
+
}
|
|
34153
34163
|
}
|
|
34154
34164
|
const priceCents = Math.round(median * 100);
|
|
34155
34165
|
const priceWith8Decimals = BigInt(priceCents) * 1000000n;
|