@gvnrdao/dh-sdk 0.0.347 → 0.0.349
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/contracts/typechain-contracts/factories/src/agent/AgentDelegationRegistry__factory.d.ts +80 -1
- package/dist/contracts/typechain-contracts/src/agent/AgentDelegationRegistry.d.ts +85 -8
- package/dist/deployments.js +20 -8
- package/dist/deployments.mjs +20 -8
- package/dist/index.d.ts +3 -1
- package/dist/index.js +948 -417
- package/dist/index.mjs +855 -335
- package/dist/interfaces/chunks/loan-operations.i.d.ts +0 -6
- package/dist/modules/diamond-hands-sdk.d.ts +8 -4
- package/dist/modules/withdrawal-address/withdrawal-address.module.d.ts +9 -1
- package/dist/safe-delegation.js +20 -8
- package/dist/safe-delegation.mjs +20 -8
- package/dist/sign-guard.js +737 -0
- package/dist/sign-guard.mjs +734 -0
- package/dist/utils/address-conversion.utils.d.ts +16 -3
- package/dist/utils/agent-delegation.utils.d.ts +19 -4
- package/dist/utils/btc-spend-request-712.d.ts +150 -0
- package/dist/utils/btc-withdrawal-message.d.ts +40 -27
- package/dist/utils/sign-guard/index.d.ts +1 -0
- package/dist/utils/sign-guard/typed-data-guard.d.ts +68 -0
- package/dist/utils/stale-spend-invalidate-message.d.ts +28 -15
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -358,7 +358,7 @@ var init_deployment_addresses = __esm({
|
|
|
358
358
|
BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
|
|
359
359
|
BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY_IMPL: "0x76E0a2c9d89562fD7c50b5f554d7fa25957e39Db",
|
|
360
360
|
AGENT_DELEGATION_REGISTRY: "0x6AE7fc6bE0925126b9D25b1B7Ce5AD5d127ec025",
|
|
361
|
-
AGENT_DELEGATION_REGISTRY_IMPL: "
|
|
361
|
+
AGENT_DELEGATION_REGISTRY_IMPL: "0x56a5af2C1549EFf70feD1F3BB8E1997717A84973",
|
|
362
362
|
DH_AGENT_DELEGATE: "0xa5A14489ae883960df6E1463A41a47aBE9Ecc5AF"
|
|
363
363
|
}
|
|
364
364
|
};
|
|
@@ -541,14 +541,26 @@ var init_deployment_addresses = __esm({
|
|
|
541
541
|
block: 25669024
|
|
542
542
|
},
|
|
543
543
|
PositionManagerViews: {
|
|
544
|
-
previousImplementation: "
|
|
545
|
-
newImplementation: "
|
|
544
|
+
previousImplementation: "0xE68DC096A65Ecddbc6A9b5c6e5f878e2CE143Bfe",
|
|
545
|
+
newImplementation: "0x8fe7aF14dB9Bef814c4c8fBc0ce206Cb17F25E8e",
|
|
546
546
|
proxy: "0x8B57954eA338c6A6bfF1457f71080e25baFF3937",
|
|
547
|
-
upgradedAt: "2026-
|
|
548
|
-
upgradedBy: "
|
|
549
|
-
reason: "
|
|
550
|
-
executeTx: "
|
|
551
|
-
block:
|
|
547
|
+
upgradedAt: "2026-10-17T12:16:35.000Z",
|
|
548
|
+
upgradedBy: "AdminModule generic-op 0x60494d283c30afb95748d8c1bb95b800ab8f17d2a2a45fb04784ebde7b05393c upgradeToAndCall(0x8fe7aF14, initializeV2(AdminModule)) \u2014 3-of-3 signatures (0x3030C041, 0x52b67f31, 0xfb3B8cbe), 24h timelock; proposed by Safe 0x3030C0414B6d95aA9d5A57269E51a347fCBaB472 in tx 0xffe3dd376736d542a89f944290b876d8eb8e5c3df8fc8349bc34a963106dd0f2, executed from Safe 0x52b67f31Ca7A58Ef20322512EB359b7D4758C868 via onchain-auth/.safe-batches/mainnet-pmv-backing-view-execute.json",
|
|
549
|
+
reason: "PoR vault-address gaps (tasks/vault-address-por-gaps-plan-2026-10-02.md, runbook tasks/RUNBOOK-pmv-backing-view-mainnet-2026-10-02.md). VERSION 1.1.1 -> 1.1.2: adds getBackingVaults (paged backing set: positions with ucdDebt > 0 and their stored vault addresses), locks the implementation (_disableInitializers constructor), and the call data initializeV2(AdminModule) consumes the previously OPEN reinitializer(2) (Cloudflare audit finding) without changing adminModule. No storage layout change. Post-upgrade: scripts/audit/backing-vaults-verify.ts PASS @ block 26226360 (72 positions, 15 backing vaults, view == independent scan; Initializable version 2; impl locked). Pre-proposed rollback op 0x43f50eb30d360a779f24c8229dd2d3b56a5d9eb40f056d3cd13047e5f0f51e84 (1/3 sigs) is to be cancelled by the proposer Safe via mainnet-pmv-backing-view-cancel-REVERT.json.",
|
|
550
|
+
executeTx: "0xbb36e557141827a0de990b7124ef8615352a2eb8c197efb3ce3a63998994fef5",
|
|
551
|
+
block: 26212216,
|
|
552
|
+
history: [
|
|
553
|
+
{
|
|
554
|
+
previousImplementation: "0x9225647a30bbACA4Acc0491B786869036914242e",
|
|
555
|
+
newImplementation: "0xE68DC096A65Ecddbc6A9b5c6e5f878e2CE143Bfe",
|
|
556
|
+
proxy: "0x8B57954eA338c6A6bfF1457f71080e25baFF3937",
|
|
557
|
+
upgradedAt: "2026-08-03T08:34:23.000Z",
|
|
558
|
+
upgradedBy: "REPLACED, not upgraded. Fresh ERC1967Proxy (atomically initialized) + AdminModule generic-op 0x848a97186f0d PositionManager.setViews(proxy) \u2014 3-of-3, 24h timelock, executed in onchain-auth/.safe-batches/mainnet-release-execute-B.json",
|
|
559
|
+
reason: "2026-08 agent-stack release. The mainnet PositionManagerViews at 0x9225647a was deployed as a BARE implementation (EIP-1967 slot 0x00), so upgradeToAndCall reverts UUPSUnauthorizedCallContext \u2014 it could never be upgraded. PositionManager.setViews (added in the same Execute B batch) removed the repoint blocker, so Views was replaced behind a new proxy rather than upgraded. This makes the Pashov F3 renewal debt-ceiling check REACHABLE for the first time: ExceedsMaxLoan (0x499e7985) is present in 0xE68DC096 and absent from 0x9225647a. Views holds no protocol state (8 wiring slots + roles + pause), which is what made replacement safe. The old contract is ABANDONED, not decommissioned \u2014 it stays live and callable as the rollback target for setViews. NOTE: VERSION reads 1.1.1 on both sides; verify by address.",
|
|
560
|
+
executeTx: "0xf1f8d5fc13f45d7a3f932bf1a2d6e29381fdd41cd31298ad785bf7688df07fe6",
|
|
561
|
+
block: 25673200
|
|
562
|
+
}
|
|
563
|
+
]
|
|
552
564
|
},
|
|
553
565
|
AgentDelegationRegistry: {
|
|
554
566
|
newImplementation: "0xa9fF405Edd4329fc3159a64F56B37EBD253e4928",
|
|
@@ -1111,6 +1123,9 @@ var require_pkg_src = __commonJS({
|
|
|
1111
1123
|
BORROWER_AUTHORIZATION_ENCODE_TYPES: () => BORROWER_AUTHORIZATION_ENCODE_TYPES,
|
|
1112
1124
|
BORROWER_AUTHORIZATION_FIELDS: () => BORROWER_AUTHORIZATION_FIELDS,
|
|
1113
1125
|
BORROWER_AUTHORIZATION_PRIMARY_TYPES: () => BORROWER_AUTHORIZATION_PRIMARY_TYPES,
|
|
1126
|
+
BTC_SPEND_REQUEST_ENCODE_TYPES: () => BTC_SPEND_REQUEST_ENCODE_TYPES,
|
|
1127
|
+
BTC_SPEND_REQUEST_FIELDS: () => BTC_SPEND_REQUEST_FIELDS,
|
|
1128
|
+
BTC_SPEND_REQUEST_PRIMARY_TYPES: () => BTC_SPEND_REQUEST_PRIMARY_TYPES,
|
|
1114
1129
|
CHIPOTLE_DEPLOYMENTS: () => CHIPOTLE_DEPLOYMENTS,
|
|
1115
1130
|
DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
|
|
1116
1131
|
DEFAULT_DEBUG_CONFIG: () => DEFAULT_DEBUG_CONFIG,
|
|
@@ -1124,8 +1139,11 @@ var require_pkg_src = __commonJS({
|
|
|
1124
1139
|
RetryStrategy: () => RetryStrategy,
|
|
1125
1140
|
analyzeError: () => analyzeError,
|
|
1126
1141
|
borrowerAuthorizationTypes: () => borrowerAuthorizationTypes,
|
|
1142
|
+
btcSpendRequestTypes: () => btcSpendRequestTypes,
|
|
1127
1143
|
buildBorrowerAuthorizationDomain: () => buildBorrowerAuthorizationDomain,
|
|
1144
|
+
buildBtcSpendRequestDomain: () => buildBtcSpendRequestDomain,
|
|
1128
1145
|
calculateDelay: () => calculateDelay,
|
|
1146
|
+
canonicalBtcTxid: () => canonicalBtcTxid2,
|
|
1129
1147
|
cidToHex: () => cidToHex,
|
|
1130
1148
|
classifyError: () => classifyError,
|
|
1131
1149
|
clearSessionSignatureCache: () => clearSessionSignatureCache,
|
|
@@ -1371,30 +1389,30 @@ var require_pkg_src = __commonJS({
|
|
|
1371
1389
|
}
|
|
1372
1390
|
},
|
|
1373
1391
|
btcTransactionSigner: {
|
|
1374
|
-
cid: "
|
|
1392
|
+
cid: "Qmb6TKy8Qv9PYXzjhgfKRnVaNW7SPXsrRUrUhcaaDQ39wd",
|
|
1375
1393
|
authorizedCidHex: cidToHex(
|
|
1376
|
-
"
|
|
1394
|
+
"Qmb6TKy8Qv9PYXzjhgfKRnVaNW7SPXsrRUrUhcaaDQ39wd"
|
|
1377
1395
|
),
|
|
1378
1396
|
name: "Btc Transaction Signer",
|
|
1379
1397
|
description: "Production Btc Transaction Signer",
|
|
1380
|
-
version: "1.
|
|
1398
|
+
version: "1.3.1",
|
|
1381
1399
|
deployed: true,
|
|
1382
|
-
deployedAt:
|
|
1383
|
-
size:
|
|
1384
|
-
hash: "
|
|
1400
|
+
deployedAt: 1792436882589,
|
|
1401
|
+
size: 78254,
|
|
1402
|
+
hash: "194e1c3e9d2f07873bab8e431ba0cda4f66143b15deb196651a375682408c8c4"
|
|
1385
1403
|
},
|
|
1386
1404
|
ucdMintValidator: {
|
|
1387
|
-
cid: "
|
|
1405
|
+
cid: "QmRUdAWMRmTno7SBNLj26ptjKYm8wY9CZN7QiNtuZ8oDkZ",
|
|
1388
1406
|
authorizedCidHex: cidToHex(
|
|
1389
|
-
"
|
|
1407
|
+
"QmRUdAWMRmTno7SBNLj26ptjKYm8wY9CZN7QiNtuZ8oDkZ"
|
|
1390
1408
|
),
|
|
1391
1409
|
name: "Ucd Mint Validator",
|
|
1392
1410
|
description: "Production Ucd Mint Validator",
|
|
1393
|
-
version: "1.3
|
|
1411
|
+
version: "1.4.3",
|
|
1394
1412
|
deployed: true,
|
|
1395
|
-
deployedAt:
|
|
1396
|
-
size:
|
|
1397
|
-
hash: "
|
|
1413
|
+
deployedAt: 1792487391394,
|
|
1414
|
+
size: 91079,
|
|
1415
|
+
hash: "6cb1dfee7f71c2748b036893b9ed4721faf400f65b5fd1dd6e0a692676ad527c",
|
|
1398
1416
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1399
1417
|
pkp: {
|
|
1400
1418
|
publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
|
|
@@ -1402,17 +1420,17 @@ var require_pkg_src = __commonJS({
|
|
|
1402
1420
|
}
|
|
1403
1421
|
},
|
|
1404
1422
|
processPaymentValidator: {
|
|
1405
|
-
cid: "
|
|
1423
|
+
cid: "Qme4X6mFBWr8ERR33CxQX7V6Y9x5ohJPx6idcYV5wDCpNW",
|
|
1406
1424
|
authorizedCidHex: cidToHex(
|
|
1407
|
-
"
|
|
1425
|
+
"Qme4X6mFBWr8ERR33CxQX7V6Y9x5ohJPx6idcYV5wDCpNW"
|
|
1408
1426
|
),
|
|
1409
1427
|
name: "Process Payment Validator",
|
|
1410
1428
|
description: "Production Process Payment Validator",
|
|
1411
|
-
version: "1.
|
|
1429
|
+
version: "1.3.3",
|
|
1412
1430
|
deployed: true,
|
|
1413
|
-
deployedAt:
|
|
1414
|
-
size:
|
|
1415
|
-
hash: "
|
|
1431
|
+
deployedAt: 1792487398483,
|
|
1432
|
+
size: 86733,
|
|
1433
|
+
hash: "6cef474b774d1b82988fcb0353c5549c2a2bec343b6b3bef15958b8a42050e51",
|
|
1416
1434
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1417
1435
|
pkp: {
|
|
1418
1436
|
publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
|
|
@@ -1420,17 +1438,17 @@ var require_pkg_src = __commonJS({
|
|
|
1420
1438
|
}
|
|
1421
1439
|
},
|
|
1422
1440
|
extendPositionValidator: {
|
|
1423
|
-
cid: "
|
|
1441
|
+
cid: "QmZRw8DcV3MY7qt9JSYRvEtXtq675y6JHsqyx7WyvhFrFv",
|
|
1424
1442
|
authorizedCidHex: cidToHex(
|
|
1425
|
-
"
|
|
1443
|
+
"QmZRw8DcV3MY7qt9JSYRvEtXtq675y6JHsqyx7WyvhFrFv"
|
|
1426
1444
|
),
|
|
1427
1445
|
name: "Extend Position Validator",
|
|
1428
1446
|
description: "Production Extend Position Validator",
|
|
1429
|
-
version: "1.
|
|
1447
|
+
version: "1.3.3",
|
|
1430
1448
|
deployed: true,
|
|
1431
|
-
deployedAt:
|
|
1432
|
-
size:
|
|
1433
|
-
hash: "
|
|
1449
|
+
deployedAt: 1792487408209,
|
|
1450
|
+
size: 84013,
|
|
1451
|
+
hash: "e5073a6a7e6f4731a786936b602147c9176a3fa4b19e6b8c71a79faec6837e30",
|
|
1434
1452
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1435
1453
|
pkp: {
|
|
1436
1454
|
publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
|
|
@@ -1438,17 +1456,17 @@ var require_pkg_src = __commonJS({
|
|
|
1438
1456
|
}
|
|
1439
1457
|
},
|
|
1440
1458
|
btcWithdrawal: {
|
|
1441
|
-
cid: "
|
|
1459
|
+
cid: "QmPUCksZufT1aNX8rxaPDxqfbv36oT8A73us6sdauCiBSC",
|
|
1442
1460
|
authorizedCidHex: cidToHex(
|
|
1443
|
-
"
|
|
1461
|
+
"QmPUCksZufT1aNX8rxaPDxqfbv36oT8A73us6sdauCiBSC"
|
|
1444
1462
|
),
|
|
1445
1463
|
name: "Btc Withdrawal",
|
|
1446
1464
|
description: "Production Btc Withdrawal",
|
|
1447
|
-
version: "1.
|
|
1465
|
+
version: "1.3.3",
|
|
1448
1466
|
deployed: true,
|
|
1449
|
-
deployedAt:
|
|
1450
|
-
size:
|
|
1451
|
-
hash: "
|
|
1467
|
+
deployedAt: 1792487416965,
|
|
1468
|
+
size: 102401,
|
|
1469
|
+
hash: "aebb2a8721cd919bfc4754b12ca5e08ff2c776e3588994005dc5fad172bcfa42",
|
|
1452
1470
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1453
1471
|
pkp: {
|
|
1454
1472
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
@@ -1456,17 +1474,17 @@ var require_pkg_src = __commonJS({
|
|
|
1456
1474
|
}
|
|
1457
1475
|
},
|
|
1458
1476
|
liquidationValidator: {
|
|
1459
|
-
cid: "
|
|
1477
|
+
cid: "QmRQFACoNtDVSKs95MhXPhkLL2tnv62ym31n8DXxHHghpw",
|
|
1460
1478
|
authorizedCidHex: cidToHex(
|
|
1461
|
-
"
|
|
1479
|
+
"QmRQFACoNtDVSKs95MhXPhkLL2tnv62ym31n8DXxHHghpw"
|
|
1462
1480
|
),
|
|
1463
1481
|
name: "Liquidation Validator",
|
|
1464
1482
|
description: "Production Liquidation Validator",
|
|
1465
|
-
version: "1.
|
|
1483
|
+
version: "1.3.3",
|
|
1466
1484
|
deployed: true,
|
|
1467
|
-
deployedAt:
|
|
1468
|
-
size:
|
|
1469
|
-
hash: "
|
|
1485
|
+
deployedAt: 1792487425791,
|
|
1486
|
+
size: 71477,
|
|
1487
|
+
hash: "f4d466f290ffb5c07ae1204f239accffb8c26ee74db947255c8031a3cb34fdcd",
|
|
1470
1488
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1471
1489
|
pkp: {
|
|
1472
1490
|
publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
|
|
@@ -1492,17 +1510,17 @@ var require_pkg_src = __commonJS({
|
|
|
1492
1510
|
}
|
|
1493
1511
|
},
|
|
1494
1512
|
loanVaultBtcBalance: {
|
|
1495
|
-
cid: "
|
|
1513
|
+
cid: "QmRzXY7nHYyJPi5yWKbCJNwTnxW7HcrxnAsKyiiGNmztZ5",
|
|
1496
1514
|
authorizedCidHex: cidToHex(
|
|
1497
|
-
"
|
|
1515
|
+
"QmRzXY7nHYyJPi5yWKbCJNwTnxW7HcrxnAsKyiiGNmztZ5"
|
|
1498
1516
|
),
|
|
1499
1517
|
name: "Loan Vault Btc Balance",
|
|
1500
1518
|
description: "Production Loan Vault Btc Balance",
|
|
1501
|
-
version: "1.
|
|
1519
|
+
version: "1.3.3",
|
|
1502
1520
|
deployed: true,
|
|
1503
|
-
deployedAt:
|
|
1504
|
-
size:
|
|
1505
|
-
hash: "
|
|
1521
|
+
deployedAt: 1792487434368,
|
|
1522
|
+
size: 61212,
|
|
1523
|
+
hash: "0b6b07ceb204a790a9ab83a36597012c733572c7423dd4acf49bde1363d5e96c",
|
|
1506
1524
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1507
1525
|
pkp: {
|
|
1508
1526
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
@@ -1516,17 +1534,17 @@ var require_pkg_src = __commonJS({
|
|
|
1516
1534
|
// Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
|
|
1517
1535
|
// on each target chain (the action decrypts registry slots). No OAR entry.
|
|
1518
1536
|
btcAddressBalance: {
|
|
1519
|
-
cid: "
|
|
1537
|
+
cid: "QmYqAW1sDqPEos5KhhLkRXsgKUEScxM9cpeNnLkHusEMpF",
|
|
1520
1538
|
authorizedCidHex: cidToHex(
|
|
1521
|
-
"
|
|
1539
|
+
"QmYqAW1sDqPEos5KhhLkRXsgKUEScxM9cpeNnLkHusEMpF"
|
|
1522
1540
|
),
|
|
1523
1541
|
name: "Btc Address Balance",
|
|
1524
1542
|
description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
|
|
1525
|
-
version: "0.2
|
|
1543
|
+
version: "0.3.2",
|
|
1526
1544
|
deployed: true,
|
|
1527
|
-
deployedAt:
|
|
1528
|
-
size:
|
|
1529
|
-
hash: "
|
|
1545
|
+
deployedAt: 1792360075629,
|
|
1546
|
+
size: 31909,
|
|
1547
|
+
hash: "2297c7b625340f048b5926325a14c958016594b77f4c4270ef413b164a8ac975",
|
|
1530
1548
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1531
1549
|
pkp: {
|
|
1532
1550
|
publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
|
|
@@ -1560,30 +1578,30 @@ var require_pkg_src = __commonJS({
|
|
|
1560
1578
|
hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
|
|
1561
1579
|
},
|
|
1562
1580
|
agentModuleExecutor: {
|
|
1563
|
-
cid: "
|
|
1581
|
+
cid: "QmPTQm5CtKnN3PLAitDRNQCuAeegATMWVWQbRrKiMCTz6V",
|
|
1564
1582
|
authorizedCidHex: cidToHex(
|
|
1565
|
-
"
|
|
1583
|
+
"QmPTQm5CtKnN3PLAitDRNQCuAeegATMWVWQbRrKiMCTz6V"
|
|
1566
1584
|
),
|
|
1567
1585
|
name: "Agent Module Executor",
|
|
1568
1586
|
description: "Production Agent Module Executor",
|
|
1569
|
-
version: "1.
|
|
1587
|
+
version: "1.3.0",
|
|
1570
1588
|
deployed: true,
|
|
1571
|
-
deployedAt:
|
|
1572
|
-
size:
|
|
1573
|
-
hash: "
|
|
1589
|
+
deployedAt: 1792419196606,
|
|
1590
|
+
size: 17562,
|
|
1591
|
+
hash: "a10d463ffd48f2392401efe3dde566faa1869e5e089db830632873a5b9528ee0"
|
|
1574
1592
|
},
|
|
1575
1593
|
staleSpendRecoveryValidator: {
|
|
1576
|
-
cid: "
|
|
1594
|
+
cid: "QmYnD65RjagWkv2eLz117GBfNfPwB7Dy1e8WXFe7yGWrt3",
|
|
1577
1595
|
authorizedCidHex: cidToHex(
|
|
1578
|
-
"
|
|
1596
|
+
"QmYnD65RjagWkv2eLz117GBfNfPwB7Dy1e8WXFe7yGWrt3"
|
|
1579
1597
|
),
|
|
1580
1598
|
name: "Stale Spend Recovery Validator",
|
|
1581
1599
|
description: "Production Stale Spend Recovery Validator",
|
|
1582
|
-
version: "1.
|
|
1600
|
+
version: "1.2.3",
|
|
1583
1601
|
deployed: true,
|
|
1584
|
-
deployedAt:
|
|
1585
|
-
size:
|
|
1586
|
-
hash: "
|
|
1602
|
+
deployedAt: 1792436943524,
|
|
1603
|
+
size: 49866,
|
|
1604
|
+
hash: "8f66007ed73c0a969051bbb8fec1cc51d119ecd01748eed4cdc59b3b1e4597fa",
|
|
1587
1605
|
validatorWalletAddress: "0xEfb258D455a31d061Bbeb3DE3D2143BdFCB67a6C",
|
|
1588
1606
|
pkp: {
|
|
1589
1607
|
publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
|
|
@@ -1591,30 +1609,30 @@ var require_pkg_src = __commonJS({
|
|
|
1591
1609
|
}
|
|
1592
1610
|
},
|
|
1593
1611
|
btcUtxoInvalidator: {
|
|
1594
|
-
cid: "
|
|
1612
|
+
cid: "QmSnXqdDt92epKi9zD7P1KqGMSzBLzCp2x4a34gHkyXvmi",
|
|
1595
1613
|
authorizedCidHex: cidToHex(
|
|
1596
|
-
"
|
|
1614
|
+
"QmSnXqdDt92epKi9zD7P1KqGMSzBLzCp2x4a34gHkyXvmi"
|
|
1597
1615
|
),
|
|
1598
1616
|
name: "Btc Utxo Invalidator",
|
|
1599
1617
|
description: "Production Btc Utxo Invalidator",
|
|
1600
|
-
version: "1.
|
|
1618
|
+
version: "1.2.1",
|
|
1601
1619
|
deployed: true,
|
|
1602
|
-
deployedAt:
|
|
1603
|
-
size:
|
|
1604
|
-
hash: "
|
|
1620
|
+
deployedAt: 1792436952354,
|
|
1621
|
+
size: 73451,
|
|
1622
|
+
hash: "a04848a16b411362aa7a5ff05ad7c93adc6a1368ef2c5f25dcfbe7c225ff5d1f"
|
|
1605
1623
|
},
|
|
1606
1624
|
carryCollateralAttestation: {
|
|
1607
|
-
cid: "
|
|
1625
|
+
cid: "QmXq8oBGZEP39pAGYe5vMvzMYUHmSVDcBb4o8XYotEE79m",
|
|
1608
1626
|
authorizedCidHex: cidToHex(
|
|
1609
|
-
"
|
|
1627
|
+
"QmXq8oBGZEP39pAGYe5vMvzMYUHmSVDcBb4o8XYotEE79m"
|
|
1610
1628
|
),
|
|
1611
1629
|
name: "Carry Collateral Attestation",
|
|
1612
1630
|
description: "LoanCarryVault collateral attestation (borrower, BTC vault, confirmed BTC)",
|
|
1613
|
-
version: "1.
|
|
1631
|
+
version: "1.1.3",
|
|
1614
1632
|
deployed: true,
|
|
1615
|
-
deployedAt:
|
|
1616
|
-
size:
|
|
1617
|
-
hash: "
|
|
1633
|
+
deployedAt: 1792487442698,
|
|
1634
|
+
size: 22275,
|
|
1635
|
+
hash: "0a4203a829b9af30f694190137f80b278b438fe2f885596dba469a6811ca1008"
|
|
1618
1636
|
},
|
|
1619
1637
|
carryFundingAttestation: {
|
|
1620
1638
|
cid: "QmWhox3xUZMNR5NpPZ9WLSPC5GoW4ms88GanVRKr8uuS3W",
|
|
@@ -2373,7 +2391,7 @@ ${errorReport}`);
|
|
|
2373
2391
|
}
|
|
2374
2392
|
init_debug_logger();
|
|
2375
2393
|
init_session_signature_cache();
|
|
2376
|
-
var
|
|
2394
|
+
var import_ethers25 = require("ethers");
|
|
2377
2395
|
var EXPIRED_LOAN_MIN_LIQUIDATION_THRESHOLD_BPS = 11e3;
|
|
2378
2396
|
var GRACE_PERIOD_DAYS = 30;
|
|
2379
2397
|
var SATOSHIS_PER_BITCOIN = 100000000n;
|
|
@@ -2611,6 +2629,87 @@ ${errorReport}`);
|
|
|
2611
2629
|
);
|
|
2612
2630
|
return newCollateralRatioBps >= requiredRatioBps;
|
|
2613
2631
|
}
|
|
2632
|
+
var DRPC_DOMAINS = ["drpc.org", "drpc.live"];
|
|
2633
|
+
var DRPC_KEY_HEADER = "Drpc-Key";
|
|
2634
|
+
var DRPC_KEY_PATTERN = /^[A-Za-z0-9_-]{16,128}$/;
|
|
2635
|
+
function isDrpcHost(hostname) {
|
|
2636
|
+
return DRPC_DOMAINS.some(
|
|
2637
|
+
(domain) => hostname === domain || hostname.endsWith(`.${domain}`)
|
|
2638
|
+
);
|
|
2639
|
+
}
|
|
2640
|
+
function assertKeyFormat(key, label) {
|
|
2641
|
+
if (typeof key !== "string" || !DRPC_KEY_PATTERN.test(key)) {
|
|
2642
|
+
throw new Error(
|
|
2643
|
+
`Invalid ${label}: expected 16-128 characters of [A-Za-z0-9_-]`
|
|
2644
|
+
);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
function assertHttps(url) {
|
|
2648
|
+
if (url.protocol !== "https:") {
|
|
2649
|
+
throw new Error(
|
|
2650
|
+
`A dRPC key is only sent over https, but the RPC URL scheme is "${url.protocol}"`
|
|
2651
|
+
);
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
function resolveDrpcKey(rpcUrl, drpcKey) {
|
|
2655
|
+
if (drpcKey === void 0) {
|
|
2656
|
+
return void 0;
|
|
2657
|
+
}
|
|
2658
|
+
assertKeyFormat(drpcKey, '"drpcKey"');
|
|
2659
|
+
const url = new URL(rpcUrl);
|
|
2660
|
+
if (!isDrpcHost(url.hostname)) {
|
|
2661
|
+
throw new Error(
|
|
2662
|
+
`"drpcKey" is only sent to dRPC, but the RPC host is "${url.hostname}" (expected ${DRPC_DOMAINS.join(" or ")})`
|
|
2663
|
+
);
|
|
2664
|
+
}
|
|
2665
|
+
assertHttps(url);
|
|
2666
|
+
if (url.searchParams.has("dkey")) {
|
|
2667
|
+
throw new Error(
|
|
2668
|
+
'"drpcKey" and a keyed rpcUrl (?dkey=) are mutually exclusive \u2014 send one'
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2671
|
+
return drpcKey;
|
|
2672
|
+
}
|
|
2673
|
+
async function litNodeRpcUrl(chain, drpcKey) {
|
|
2674
|
+
if (drpcKey !== void 0) {
|
|
2675
|
+
throw new Error(
|
|
2676
|
+
`"drpcKey" was supplied without an "rpcUrl" \u2014 the key only authenticates a caller-supplied dRPC rpcUrl, never the Lit node's own endpoint`
|
|
2677
|
+
);
|
|
2678
|
+
}
|
|
2679
|
+
return Lit.Actions.getRpcUrl({ chain });
|
|
2680
|
+
}
|
|
2681
|
+
function evmRpcConnection(rpcUrl, drpcKey, timeout) {
|
|
2682
|
+
const connection = { url: rpcUrl };
|
|
2683
|
+
const key = resolveDrpcKey(rpcUrl, drpcKey);
|
|
2684
|
+
if (key !== void 0) {
|
|
2685
|
+
connection.headers = { [DRPC_KEY_HEADER]: key };
|
|
2686
|
+
} else {
|
|
2687
|
+
const url = new URL(rpcUrl);
|
|
2688
|
+
const legacyKeys = url.searchParams.getAll("dkey");
|
|
2689
|
+
if (legacyKeys.length > 1) {
|
|
2690
|
+
throw new Error(
|
|
2691
|
+
`rpcUrl carries ${legacyKeys.length} "dkey" parameters \u2014 send exactly one dRPC key`
|
|
2692
|
+
);
|
|
2693
|
+
}
|
|
2694
|
+
if (legacyKeys.length === 1 && !isDrpcHost(url.hostname)) {
|
|
2695
|
+
throw new Error(
|
|
2696
|
+
`rpcUrl carries a dRPC key (?dkey=) but the RPC host is "${url.hostname}" \u2014 a dRPC key is only sent to ${DRPC_DOMAINS.join(" or ")}`
|
|
2697
|
+
);
|
|
2698
|
+
}
|
|
2699
|
+
if (legacyKeys.length === 1) {
|
|
2700
|
+
const legacyKey = legacyKeys[0];
|
|
2701
|
+
assertKeyFormat(legacyKey, "dRPC key in rpcUrl (?dkey=)");
|
|
2702
|
+
assertHttps(url);
|
|
2703
|
+
url.searchParams.delete("dkey");
|
|
2704
|
+
connection.url = url.toString();
|
|
2705
|
+
connection.headers = { [DRPC_KEY_HEADER]: legacyKey };
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
if (timeout !== void 0) {
|
|
2709
|
+
connection.timeout = timeout;
|
|
2710
|
+
}
|
|
2711
|
+
return connection;
|
|
2712
|
+
}
|
|
2614
2713
|
var ProtocolParametersModule = class {
|
|
2615
2714
|
constructor(config) {
|
|
2616
2715
|
this.termManagerAddress = config.termManagerAddress;
|
|
@@ -2619,6 +2718,7 @@ ${errorReport}`);
|
|
|
2619
2718
|
this.chain = config.chain;
|
|
2620
2719
|
this.chainId = config.chainId;
|
|
2621
2720
|
this.rpcUrl = config.rpcUrl;
|
|
2721
|
+
this.drpcKey = config.drpcKey;
|
|
2622
2722
|
}
|
|
2623
2723
|
/**
|
|
2624
2724
|
* Get liquidation threshold from LoanOperationsManager
|
|
@@ -2631,10 +2731,10 @@ ${errorReport}`);
|
|
|
2631
2731
|
if (this.rpcUrl) {
|
|
2632
2732
|
rpcUrl = this.rpcUrl;
|
|
2633
2733
|
} else {
|
|
2634
|
-
rpcUrl = await
|
|
2734
|
+
rpcUrl = await litNodeRpcUrl(this.chain, this.drpcKey);
|
|
2635
2735
|
}
|
|
2636
2736
|
const provider = new ethers.providers.StaticJsonRpcProvider(
|
|
2637
|
-
|
|
2737
|
+
evmRpcConnection(rpcUrl, this.drpcKey, LIT_ACTION_ETH_RPC_TIMEOUT_MS),
|
|
2638
2738
|
{
|
|
2639
2739
|
name: "any",
|
|
2640
2740
|
chainId: this.chainId
|
|
@@ -2678,10 +2778,10 @@ ${errorReport}`);
|
|
|
2678
2778
|
if (this.rpcUrl) {
|
|
2679
2779
|
rpcUrl = this.rpcUrl;
|
|
2680
2780
|
} else {
|
|
2681
|
-
rpcUrl = await
|
|
2781
|
+
rpcUrl = await litNodeRpcUrl(this.chain, this.drpcKey);
|
|
2682
2782
|
}
|
|
2683
2783
|
const provider = new ethers.providers.StaticJsonRpcProvider(
|
|
2684
|
-
|
|
2784
|
+
evmRpcConnection(rpcUrl, this.drpcKey, LIT_ACTION_ETH_RPC_TIMEOUT_MS),
|
|
2685
2785
|
{
|
|
2686
2786
|
name: "any",
|
|
2687
2787
|
chainId: this.chainId
|
|
@@ -2734,9 +2834,9 @@ ${errorReport}`);
|
|
|
2734
2834
|
*/
|
|
2735
2835
|
async getAuthorizedSpendsHash(positionId) {
|
|
2736
2836
|
try {
|
|
2737
|
-
const rpcUrl = this.rpcUrl || await
|
|
2837
|
+
const rpcUrl = this.rpcUrl || await litNodeRpcUrl(this.chain, this.drpcKey);
|
|
2738
2838
|
const provider = new ethers.providers.StaticJsonRpcProvider(
|
|
2739
|
-
|
|
2839
|
+
evmRpcConnection(rpcUrl, this.drpcKey, LIT_ACTION_ETH_RPC_TIMEOUT_MS),
|
|
2740
2840
|
{
|
|
2741
2841
|
name: "any",
|
|
2742
2842
|
chainId: this.chainId
|
|
@@ -2782,10 +2882,10 @@ ${errorReport}`);
|
|
|
2782
2882
|
if (this.rpcUrl) {
|
|
2783
2883
|
rpcUrl = this.rpcUrl;
|
|
2784
2884
|
} else {
|
|
2785
|
-
rpcUrl = await
|
|
2885
|
+
rpcUrl = await litNodeRpcUrl(this.chain, this.drpcKey);
|
|
2786
2886
|
}
|
|
2787
2887
|
const provider = new ethers.providers.StaticJsonRpcProvider(
|
|
2788
|
-
|
|
2888
|
+
evmRpcConnection(rpcUrl, this.drpcKey, LIT_ACTION_ETH_RPC_TIMEOUT_MS),
|
|
2789
2889
|
{
|
|
2790
2890
|
name: "any",
|
|
2791
2891
|
chainId: this.chainId
|
|
@@ -2827,14 +2927,14 @@ ${errorReport}`);
|
|
|
2827
2927
|
if (typeof parsed === "object" && parsed !== null) {
|
|
2828
2928
|
const chainLower = chain.toLowerCase();
|
|
2829
2929
|
if (chainLower === "sepolia") {
|
|
2830
|
-
return parsed.regtest || parsed.testnet ||
|
|
2930
|
+
return parsed.regtest || parsed.testnet || void 0;
|
|
2831
2931
|
}
|
|
2832
2932
|
const bitcoinNetwork = getBitcoinNetworkForChain(chain);
|
|
2833
2933
|
if (bitcoinNetwork === "regtest") {
|
|
2834
|
-
return parsed.regtest || parsed.testnet ||
|
|
2934
|
+
return parsed.regtest || parsed.testnet || void 0;
|
|
2835
2935
|
}
|
|
2836
2936
|
if (bitcoinNetwork === "testnet") {
|
|
2837
|
-
return parsed.testnet || parsed.regtest ||
|
|
2937
|
+
return parsed.testnet || parsed.regtest || void 0;
|
|
2838
2938
|
}
|
|
2839
2939
|
return parsed.mainnet;
|
|
2840
2940
|
}
|
|
@@ -2844,6 +2944,9 @@ ${errorReport}`);
|
|
|
2844
2944
|
}
|
|
2845
2945
|
var VaultSnapshotModule = class {
|
|
2846
2946
|
constructor(config) {
|
|
2947
|
+
if (!Number.isInteger(config.chainId) || config.chainId <= 0) {
|
|
2948
|
+
throw new Error(`VaultSnapshotModule requires a positive integer chainId, got ${String(config.chainId)}`);
|
|
2949
|
+
}
|
|
2847
2950
|
this.config = config;
|
|
2848
2951
|
}
|
|
2849
2952
|
/**
|
|
@@ -2860,8 +2963,7 @@ ${errorReport}`);
|
|
|
2860
2963
|
console.log(
|
|
2861
2964
|
`[Vault Snapshot] Raw vault address from contract: "${positionState.vaultAddress}"`
|
|
2862
2965
|
);
|
|
2863
|
-
const
|
|
2864
|
-
const [balanceResult, btcPriceUsd] = useStubbedBtcData ? this.buildStubbedBtcSnapshotInputs(positionState) : await Promise.all([
|
|
2966
|
+
const [balanceResult, btcPriceUsd] = await Promise.all([
|
|
2865
2967
|
this.config.vaultBalance.calculateTrustedBalance(
|
|
2866
2968
|
positionId,
|
|
2867
2969
|
positionState.vaultAddress
|
|
@@ -2873,9 +2975,9 @@ ${errorReport}`);
|
|
|
2873
2975
|
loanOpsManagerAddress: this.config.loanOpsManagerAddress,
|
|
2874
2976
|
liquidationManagerAddress: this.config.liquidationManagerAddress,
|
|
2875
2977
|
chain: this.config.chain,
|
|
2876
|
-
chainId: this.config.chainId
|
|
2877
|
-
|
|
2878
|
-
|
|
2978
|
+
chainId: this.config.chainId,
|
|
2979
|
+
rpcUrl: this.config.rpcUrl,
|
|
2980
|
+
drpcKey: this.config.drpcKey
|
|
2879
2981
|
});
|
|
2880
2982
|
const termForFees = this.config.termOverride ?? positionState.selectedTerm;
|
|
2881
2983
|
const [liquidationThresholdBps, maxEscalatedThresholdBps, termFees] = await Promise.all([
|
|
@@ -2954,34 +3056,6 @@ ${errorReport}`);
|
|
|
2954
3056
|
// a snapshot whose balance skipped UTXO validation + consensus must never
|
|
2955
3057
|
// exist within reach of a signing flow. Every snapshot now runs the full
|
|
2956
3058
|
// validation path above.
|
|
2957
|
-
buildStubbedBtcSnapshotInputs(positionState) {
|
|
2958
|
-
const stubbedAvailableBtcSats = BigInt(
|
|
2959
|
-
this.config.debugOverrides?.stubbedAvailableBtcSats ?? "10000000"
|
|
2960
|
-
);
|
|
2961
|
-
const stubbedBtcPriceUsd = BigInt(
|
|
2962
|
-
this.config.debugOverrides?.stubbedBtcPriceUsd ?? "5000000000000"
|
|
2963
|
-
);
|
|
2964
|
-
const stubbedAuthorizedSpendsHash = this.config.debugOverrides?.stubbedAuthorizedSpendsHash ?? // keccak256(abi.encode(positionId, []))
|
|
2965
|
-
ethers.utils.keccak256(
|
|
2966
|
-
ethers.utils.defaultAbiCoder.encode(
|
|
2967
|
-
["bytes32", "bytes32[]"],
|
|
2968
|
-
[positionState.positionId, []]
|
|
2969
|
-
)
|
|
2970
|
-
);
|
|
2971
|
-
const balanceResult = {
|
|
2972
|
-
totalUTXOs: [],
|
|
2973
|
-
totalBalance: stubbedAvailableBtcSats,
|
|
2974
|
-
authorizedUTXOs: [],
|
|
2975
|
-
authorizedBalance: 0n,
|
|
2976
|
-
authorizedSpendsHash: stubbedAuthorizedSpendsHash,
|
|
2977
|
-
availableUTXOs: [],
|
|
2978
|
-
availableBalance: stubbedAvailableBtcSats,
|
|
2979
|
-
vaultAddress: positionState.vaultAddress,
|
|
2980
|
-
positionId: positionState.positionId,
|
|
2981
|
-
timestamp: Date.now()
|
|
2982
|
-
};
|
|
2983
|
-
return [balanceResult, stubbedBtcPriceUsd];
|
|
2984
|
-
}
|
|
2985
3059
|
/**
|
|
2986
3060
|
* Query position state from smart contract
|
|
2987
3061
|
*
|
|
@@ -2998,10 +3072,10 @@ ${errorReport}`);
|
|
|
2998
3072
|
if (this.config.rpcUrl) {
|
|
2999
3073
|
rpcUrl = this.config.rpcUrl;
|
|
3000
3074
|
} else {
|
|
3001
|
-
rpcUrl = await
|
|
3075
|
+
rpcUrl = await litNodeRpcUrl(this.config.chain, this.config.drpcKey);
|
|
3002
3076
|
}
|
|
3003
3077
|
const provider = new ethers.providers.StaticJsonRpcProvider(
|
|
3004
|
-
|
|
3078
|
+
evmRpcConnection(rpcUrl, this.config.drpcKey, LIT_ACTION_ETH_RPC_TIMEOUT_MS),
|
|
3005
3079
|
this.config.chainId
|
|
3006
3080
|
);
|
|
3007
3081
|
const diamondContract = new ethers.Contract(
|
|
@@ -5210,10 +5284,10 @@ ${auth.clientId}`;
|
|
|
5210
5284
|
if (this.config.rpcUrl) {
|
|
5211
5285
|
rpcUrl = this.config.rpcUrl;
|
|
5212
5286
|
} else {
|
|
5213
|
-
rpcUrl = await
|
|
5287
|
+
rpcUrl = await litNodeRpcUrl(this.config.chain, this.config.drpcKey);
|
|
5214
5288
|
}
|
|
5215
5289
|
const provider = new ethers.providers.StaticJsonRpcProvider(
|
|
5216
|
-
|
|
5290
|
+
evmRpcConnection(rpcUrl, this.config.drpcKey, LIT_ACTION_ETH_RPC_TIMEOUT_MS),
|
|
5217
5291
|
this.config.chainId
|
|
5218
5292
|
);
|
|
5219
5293
|
const contract = new ethers.Contract(
|
|
@@ -5380,13 +5454,17 @@ ${auth.clientId}`;
|
|
|
5380
5454
|
return policy;
|
|
5381
5455
|
}
|
|
5382
5456
|
async function executeVaultSnapshot(params) {
|
|
5457
|
+
const chainId = params.chainId;
|
|
5458
|
+
if (chainId === void 0 || !Number.isInteger(chainId) || chainId <= 0) {
|
|
5459
|
+
throw new Error(`executeVaultSnapshot requires a positive integer chainId, got ${String(chainId)}`);
|
|
5460
|
+
}
|
|
5383
5461
|
global.ethers = {
|
|
5384
|
-
...
|
|
5462
|
+
...import_ethers25.ethers,
|
|
5385
5463
|
providers: {
|
|
5386
|
-
StaticJsonRpcProvider:
|
|
5464
|
+
StaticJsonRpcProvider: import_ethers25.ethers.JsonRpcProvider
|
|
5387
5465
|
},
|
|
5388
|
-
Contract:
|
|
5389
|
-
utils:
|
|
5466
|
+
Contract: import_ethers25.ethers.Contract,
|
|
5467
|
+
utils: import_ethers25.ethers
|
|
5390
5468
|
// v6 moved utils to top level
|
|
5391
5469
|
};
|
|
5392
5470
|
global.Lit = {
|
|
@@ -5419,8 +5497,7 @@ ${auth.clientId}`;
|
|
|
5419
5497
|
const vaultBalance = createVaultBalanceModule({
|
|
5420
5498
|
contractAddress: params.loanOpsManagerAddress,
|
|
5421
5499
|
chain: params.chain,
|
|
5422
|
-
chainId
|
|
5423
|
-
// Default to mainnet if not provided
|
|
5500
|
+
chainId,
|
|
5424
5501
|
rpcUrl: params.rpcUrl,
|
|
5425
5502
|
bitcoinProvider,
|
|
5426
5503
|
minConfirmations: params.minConfirmations ?? getChainPolicy(params.chain).minBitcoinBalanceConfirmations
|
|
@@ -5431,7 +5508,7 @@ ${auth.clientId}`;
|
|
|
5431
5508
|
loanOpsManagerAddress: params.loanOpsManagerAddress,
|
|
5432
5509
|
liquidationManagerAddress: params.liquidationManagerAddress,
|
|
5433
5510
|
chain: params.chain,
|
|
5434
|
-
chainId
|
|
5511
|
+
chainId,
|
|
5435
5512
|
rpcUrl: params.rpcUrl,
|
|
5436
5513
|
vaultBalance,
|
|
5437
5514
|
priceOracle
|
|
@@ -5497,6 +5574,79 @@ ${auth.clientId}`;
|
|
|
5497
5574
|
version: "2.0.0"
|
|
5498
5575
|
}
|
|
5499
5576
|
};
|
|
5577
|
+
var BTC_SPEND_REQUEST_PRIMARY_TYPES = {
|
|
5578
|
+
EXECUTE: "ExecuteBtcWithdrawalRequest",
|
|
5579
|
+
INVALIDATE: "InvalidateStaleSpendRequest"
|
|
5580
|
+
};
|
|
5581
|
+
var BTC_SPEND_REQUEST_FIELDS = {
|
|
5582
|
+
ExecuteBtcWithdrawalRequest: [
|
|
5583
|
+
{ name: "positionId", type: "bytes32" },
|
|
5584
|
+
{ name: "withdrawalAddress", type: "string" },
|
|
5585
|
+
{ name: "recipientAmount", type: "uint256" },
|
|
5586
|
+
{ name: "networkFee", type: "uint256" },
|
|
5587
|
+
{ name: "totalDeduction", type: "uint256" },
|
|
5588
|
+
{ name: "spendTxid", type: "string" },
|
|
5589
|
+
{ name: "spendVout", type: "uint32" },
|
|
5590
|
+
{ name: "inputSetHash", type: "bytes32" },
|
|
5591
|
+
{ name: "quantumTimestamp", type: "uint256" }
|
|
5592
|
+
],
|
|
5593
|
+
InvalidateStaleSpendRequest: [
|
|
5594
|
+
{ name: "positionId", type: "bytes32" },
|
|
5595
|
+
{ name: "spendTxid", type: "string" },
|
|
5596
|
+
{ name: "spendVout", type: "uint32" },
|
|
5597
|
+
{ name: "quantumTimestamp", type: "uint256" }
|
|
5598
|
+
]
|
|
5599
|
+
};
|
|
5600
|
+
var BTC_SPEND_REQUEST_ENCODE_TYPES = {
|
|
5601
|
+
ExecuteBtcWithdrawalRequest: "ExecuteBtcWithdrawalRequest(bytes32 positionId,string withdrawalAddress,uint256 recipientAmount,uint256 networkFee,uint256 totalDeduction,string spendTxid,uint32 spendVout,bytes32 inputSetHash,uint256 quantumTimestamp)",
|
|
5602
|
+
InvalidateStaleSpendRequest: "InvalidateStaleSpendRequest(bytes32 positionId,string spendTxid,uint32 spendVout,uint256 quantumTimestamp)"
|
|
5603
|
+
};
|
|
5604
|
+
function btcSpendRequestTypes(primaryType) {
|
|
5605
|
+
const fields = BTC_SPEND_REQUEST_FIELDS[primaryType];
|
|
5606
|
+
if (!fields) {
|
|
5607
|
+
throw new Error(
|
|
5608
|
+
`Unknown BTC spend request primary type "${primaryType}"; expected one of ${Object.keys(BTC_SPEND_REQUEST_FIELDS).join(", ")}`
|
|
5609
|
+
);
|
|
5610
|
+
}
|
|
5611
|
+
return { [primaryType]: fields.map((field) => ({ ...field })) };
|
|
5612
|
+
}
|
|
5613
|
+
function buildBtcSpendRequestDomain(chainId, verifyingContractOverride) {
|
|
5614
|
+
if (!Number.isInteger(chainId) || chainId <= 0) {
|
|
5615
|
+
throw new Error(
|
|
5616
|
+
`BTC spend request domain requires a positive integer chainId, got ${String(chainId)}`
|
|
5617
|
+
);
|
|
5618
|
+
}
|
|
5619
|
+
const pinned = getPinnedContractAddresses(chainId);
|
|
5620
|
+
const pinnedAuthorizer = pinned?.BTCSpendAuthorizer;
|
|
5621
|
+
if (pinnedAuthorizer && verifyingContractOverride) {
|
|
5622
|
+
if (pinnedAuthorizer.toLowerCase() !== verifyingContractOverride.toLowerCase()) {
|
|
5623
|
+
throw new Error(
|
|
5624
|
+
`Refusing a caller-supplied verifyingContract that contradicts the pin for chainId ${chainId}: caller ${verifyingContractOverride}, pinned ${pinnedAuthorizer}`
|
|
5625
|
+
);
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
const verifyingContract = pinnedAuthorizer ?? verifyingContractOverride;
|
|
5629
|
+
if (!verifyingContract) {
|
|
5630
|
+
throw new Error(
|
|
5631
|
+
`No pinned BTCSpendAuthorizer for chainId ${chainId} and no verifyingContract supplied; refusing to build a BTC spend request domain without one`
|
|
5632
|
+
);
|
|
5633
|
+
}
|
|
5634
|
+
return {
|
|
5635
|
+
name: PROTOCOL_EIP712_DOMAIN_NAME,
|
|
5636
|
+
version: PROTOCOL_EIP712_DOMAIN_VERSION,
|
|
5637
|
+
chainId,
|
|
5638
|
+
verifyingContract
|
|
5639
|
+
};
|
|
5640
|
+
}
|
|
5641
|
+
function canonicalBtcTxid2(txid) {
|
|
5642
|
+
const canonical = String(txid).toLowerCase().replace(/^0x/, "");
|
|
5643
|
+
if (!/^[0-9a-f]{64}$/.test(canonical)) {
|
|
5644
|
+
throw new Error(
|
|
5645
|
+
`Invalid Bitcoin txid "${String(txid)}": expected 64 hex characters (optionally 0x-prefixed)`
|
|
5646
|
+
);
|
|
5647
|
+
}
|
|
5648
|
+
return canonical;
|
|
5649
|
+
}
|
|
5500
5650
|
}
|
|
5501
5651
|
});
|
|
5502
5652
|
|
|
@@ -5736,7 +5886,7 @@ function getMainnetConfig() {
|
|
|
5736
5886
|
function getLocalhostConfig() {
|
|
5737
5887
|
const deployment = loadDeploymentData("localhost");
|
|
5738
5888
|
const contracts = deployment?.contracts || {};
|
|
5739
|
-
const
|
|
5889
|
+
const getAddress2 = (envKey, contractKey) => {
|
|
5740
5890
|
return process.env[envKey] || contracts[contractKey] || "";
|
|
5741
5891
|
};
|
|
5742
5892
|
logNetworkConfig(
|
|
@@ -5745,17 +5895,17 @@ function getLocalhostConfig() {
|
|
|
5745
5895
|
deployment ? "YES" : "NO"
|
|
5746
5896
|
);
|
|
5747
5897
|
logNetworkConfig("log", "[NetworkConfig] Localhost contracts:", {
|
|
5748
|
-
PositionManager:
|
|
5749
|
-
PositionManagerCore:
|
|
5898
|
+
PositionManager: getAddress2("POSITION_MANAGER_ADDRESS", "PositionManager"),
|
|
5899
|
+
PositionManagerCore: getAddress2(
|
|
5750
5900
|
"POSITION_MANAGER_CORE_ADDRESS",
|
|
5751
5901
|
"PositionManagerCoreModule"
|
|
5752
5902
|
),
|
|
5753
|
-
LoanOperationsManagerModule:
|
|
5903
|
+
LoanOperationsManagerModule: getAddress2(
|
|
5754
5904
|
"LOAN_OPERATIONS_MANAGER_ADDRESS",
|
|
5755
5905
|
"LoanOperationsManagerModule"
|
|
5756
5906
|
),
|
|
5757
|
-
TermManagerModule:
|
|
5758
|
-
UCDToken:
|
|
5907
|
+
TermManagerModule: getAddress2("TERM_MANAGER_ADDRESS", "TermManagerModule"),
|
|
5908
|
+
UCDToken: getAddress2("UCD_TOKEN_ADDRESS", "UCDToken")
|
|
5759
5909
|
});
|
|
5760
5910
|
return {
|
|
5761
5911
|
mode: "service",
|
|
@@ -5764,43 +5914,43 @@ function getLocalhostConfig() {
|
|
|
5764
5914
|
name: "localhost",
|
|
5765
5915
|
rpcUrls: ["http://localhost:8545"],
|
|
5766
5916
|
contractAddresses: {
|
|
5767
|
-
positionManager:
|
|
5917
|
+
positionManager: getAddress2(
|
|
5768
5918
|
"POSITION_MANAGER_ADDRESS",
|
|
5769
5919
|
"PositionManager"
|
|
5770
5920
|
),
|
|
5771
|
-
positionManagerCore:
|
|
5921
|
+
positionManagerCore: getAddress2(
|
|
5772
5922
|
"POSITION_MANAGER_CORE_ADDRESS",
|
|
5773
5923
|
"PositionManagerCoreModule"
|
|
5774
5924
|
),
|
|
5775
|
-
positionManagerViews:
|
|
5925
|
+
positionManagerViews: getAddress2(
|
|
5776
5926
|
"POSITION_MANAGER_VIEWS_ADDRESS",
|
|
5777
5927
|
"PositionManagerViews"
|
|
5778
5928
|
),
|
|
5779
|
-
simplePsmV2:
|
|
5780
|
-
loanOperationsManager:
|
|
5929
|
+
simplePsmV2: getAddress2("SIMPLE_PSM_V2_ADDRESS", "SimplePSMV2"),
|
|
5930
|
+
loanOperationsManager: getAddress2(
|
|
5781
5931
|
"LOAN_OPERATIONS_MANAGER_ADDRESS",
|
|
5782
5932
|
"LoanOperationsManagerModule"
|
|
5783
5933
|
),
|
|
5784
|
-
termManager:
|
|
5785
|
-
circuitBreaker:
|
|
5934
|
+
termManager: getAddress2("TERM_MANAGER_ADDRESS", "TermManagerModule"),
|
|
5935
|
+
circuitBreaker: getAddress2(
|
|
5786
5936
|
"CIRCUIT_BREAKER_ADDRESS",
|
|
5787
5937
|
"CircuitBreakerModule"
|
|
5788
5938
|
),
|
|
5789
|
-
liquidationManager:
|
|
5939
|
+
liquidationManager: getAddress2(
|
|
5790
5940
|
"LIQUIDATION_MANAGER_ADDRESS",
|
|
5791
5941
|
"LiquidationManagerModule"
|
|
5792
5942
|
),
|
|
5793
|
-
ucdToken:
|
|
5794
|
-
ucdController:
|
|
5795
|
-
priceFeedConsumer:
|
|
5943
|
+
ucdToken: getAddress2("UCD_TOKEN_ADDRESS", "UCDToken"),
|
|
5944
|
+
ucdController: getAddress2("UCD_CONTROLLER_ADDRESS", "UCDController"),
|
|
5945
|
+
priceFeedConsumer: getAddress2(
|
|
5796
5946
|
"PRICE_FEED_CONSUMER_ADDRESS",
|
|
5797
5947
|
"PriceFeedConsumer"
|
|
5798
5948
|
),
|
|
5799
|
-
operationAuthorizationRegistry:
|
|
5949
|
+
operationAuthorizationRegistry: getAddress2(
|
|
5800
5950
|
"OPERATION_AUTHORIZATION_REGISTRY_ADDRESS",
|
|
5801
5951
|
"OperationAuthorizationRegistry"
|
|
5802
5952
|
),
|
|
5803
|
-
btcSpendAuthorizer:
|
|
5953
|
+
btcSpendAuthorizer: getAddress2(
|
|
5804
5954
|
"BTC_SPEND_AUTHORIZER_ADDRESS",
|
|
5805
5955
|
"BTCSpendAuthorizer"
|
|
5806
5956
|
)
|
|
@@ -5874,6 +6024,11 @@ __export(src_exports, {
|
|
|
5874
6024
|
ALL_DEPLOYMENTS: () => ALL_DEPLOYMENTS,
|
|
5875
6025
|
AuthParamsValidation: () => AuthParamsValidation,
|
|
5876
6026
|
BPSConversions: () => BPSConversions,
|
|
6027
|
+
BTC_SPEND_QUANTUM_SECONDS: () => BTC_SPEND_QUANTUM_SECONDS,
|
|
6028
|
+
BTC_SPEND_RELAY_DEADLINE_SECONDS: () => BTC_SPEND_RELAY_DEADLINE_SECONDS,
|
|
6029
|
+
BTC_SPEND_REQUEST_712_DOMAIN_NAME: () => BTC_SPEND_REQUEST_712_DOMAIN_NAME,
|
|
6030
|
+
BTC_SPEND_REQUEST_712_DOMAIN_VERSION: () => BTC_SPEND_REQUEST_712_DOMAIN_VERSION,
|
|
6031
|
+
BTC_SPEND_REQUEST_712_FIELDS: () => BTC_SPEND_REQUEST_712_FIELDS,
|
|
5877
6032
|
BitcoinOperations: () => BitcoinOperations,
|
|
5878
6033
|
CacheManager: () => CacheManager,
|
|
5879
6034
|
ContractManager: () => ContractManager,
|
|
@@ -5907,9 +6062,15 @@ __export(src_exports, {
|
|
|
5907
6062
|
andThen: () => andThen,
|
|
5908
6063
|
assertProtocolNotPaused: () => assertProtocolNotPaused,
|
|
5909
6064
|
assertSafeServiceEndpoint: () => assertSafeServiceEndpoint,
|
|
6065
|
+
btcSpendAuthorizerAddress: () => btcSpendAuthorizerAddress,
|
|
6066
|
+
btcSpendRequest712Digest: () => btcSpendRequest712Digest,
|
|
6067
|
+
btcSpendRequest712Types: () => btcSpendRequest712Types,
|
|
5910
6068
|
buildBtcExecuteEnvelope: () => buildBtcExecuteEnvelope,
|
|
6069
|
+
buildBtcSpendRequest712Domain: () => buildBtcSpendRequest712Domain,
|
|
6070
|
+
buildExecuteBtcWithdrawalTypedData: () => buildExecuteBtcWithdrawalTypedData,
|
|
5911
6071
|
buildInvalidateMessageHash: () => buildInvalidateMessageHash,
|
|
5912
6072
|
buildInvalidateStaleSpendEnvelope: () => buildInvalidateStaleSpendEnvelope,
|
|
6073
|
+
buildInvalidateStaleSpendTypedData: () => buildInvalidateStaleSpendTypedData,
|
|
5913
6074
|
buildLoginDomain: () => buildLoginDomain,
|
|
5914
6075
|
buildSignedLoginPayload: () => buildSignedLoginPayload,
|
|
5915
6076
|
collectFailures: () => collectFailures,
|
|
@@ -5951,8 +6112,10 @@ __export(src_exports, {
|
|
|
5951
6112
|
mapError: () => mapError,
|
|
5952
6113
|
match: () => match,
|
|
5953
6114
|
numericToPositionStatus: () => numericToPositionStatus,
|
|
6115
|
+
readAuthorizedSpend: () => readAuthorizedSpend,
|
|
5954
6116
|
reconcileAuthorizedSpend: () => reconcileAuthorizedSpend,
|
|
5955
6117
|
setPositionDelegate: () => setPositionDelegate,
|
|
6118
|
+
signBtcSpendRequest712: () => signBtcSpendRequest712,
|
|
5956
6119
|
success: () => success,
|
|
5957
6120
|
toPromise: () => toPromise,
|
|
5958
6121
|
tryCatch: () => tryCatch,
|
|
@@ -5966,7 +6129,7 @@ __export(src_exports, {
|
|
|
5966
6129
|
module.exports = __toCommonJS(src_exports);
|
|
5967
6130
|
|
|
5968
6131
|
// src/modules/diamond-hands-sdk.ts
|
|
5969
|
-
var
|
|
6132
|
+
var import_ethers23 = require("ethers");
|
|
5970
6133
|
|
|
5971
6134
|
// src/types/result.ts
|
|
5972
6135
|
function success(value) {
|
|
@@ -8036,17 +8199,209 @@ async function reconcileAuthorizedSpend(spend, esploraBaseUrl, httpGetJson = def
|
|
|
8036
8199
|
}
|
|
8037
8200
|
|
|
8038
8201
|
// src/utils/stale-spend-invalidate-message.ts
|
|
8202
|
+
var import_ethers8 = require("ethers");
|
|
8203
|
+
|
|
8204
|
+
// src/utils/btc-spend-request-712.ts
|
|
8039
8205
|
var import_ethers7 = require("ethers");
|
|
8206
|
+
init_deployment_addresses();
|
|
8207
|
+
var BTC_SPEND_REQUEST_712_DOMAIN_NAME = "DiamondHands.Protocol";
|
|
8208
|
+
var BTC_SPEND_REQUEST_712_DOMAIN_VERSION = "1";
|
|
8209
|
+
var BTC_SPEND_REQUEST_712_FIELDS = {
|
|
8210
|
+
ExecuteBtcWithdrawalRequest: [
|
|
8211
|
+
{ name: "positionId", type: "bytes32" },
|
|
8212
|
+
{ name: "withdrawalAddress", type: "string" },
|
|
8213
|
+
{ name: "recipientAmount", type: "uint256" },
|
|
8214
|
+
{ name: "networkFee", type: "uint256" },
|
|
8215
|
+
{ name: "totalDeduction", type: "uint256" },
|
|
8216
|
+
{ name: "spendTxid", type: "string" },
|
|
8217
|
+
{ name: "spendVout", type: "uint32" },
|
|
8218
|
+
{ name: "inputSetHash", type: "bytes32" },
|
|
8219
|
+
{ name: "quantumTimestamp", type: "uint256" }
|
|
8220
|
+
],
|
|
8221
|
+
InvalidateStaleSpendRequest: [
|
|
8222
|
+
{ name: "positionId", type: "bytes32" },
|
|
8223
|
+
{ name: "spendTxid", type: "string" },
|
|
8224
|
+
{ name: "spendVout", type: "uint32" },
|
|
8225
|
+
{ name: "quantumTimestamp", type: "uint256" }
|
|
8226
|
+
]
|
|
8227
|
+
};
|
|
8228
|
+
function btcSpendRequest712Types(primaryType) {
|
|
8229
|
+
const fields = BTC_SPEND_REQUEST_712_FIELDS[primaryType];
|
|
8230
|
+
if (!fields) {
|
|
8231
|
+
throw new Error(
|
|
8232
|
+
`Unknown BTC spend request primary type "${primaryType}"; expected one of ` + Object.keys(BTC_SPEND_REQUEST_712_FIELDS).join(", ")
|
|
8233
|
+
);
|
|
8234
|
+
}
|
|
8235
|
+
return { [primaryType]: fields.map((field) => ({ ...field })) };
|
|
8236
|
+
}
|
|
8237
|
+
function btcSpendAuthorizerAddress(chainId) {
|
|
8238
|
+
if (!Number.isInteger(chainId) || chainId <= 0) {
|
|
8239
|
+
throw new Error(
|
|
8240
|
+
`BTC spend request domain requires a positive integer chainId, got ${String(chainId)}`
|
|
8241
|
+
);
|
|
8242
|
+
}
|
|
8243
|
+
const deployment = chainId === 31337 ? ALL_DEPLOYMENTS["localhost"] : Object.values(ALL_DEPLOYMENTS).find((d) => d.chainId === chainId);
|
|
8244
|
+
const address = deployment?.contracts?.BTCSpendAuthorizer;
|
|
8245
|
+
if (!address) {
|
|
8246
|
+
throw new Error(
|
|
8247
|
+
`No BTCSpendAuthorizer deployment known for chainId ${chainId}; refusing to build a BTC spend request domain without one`
|
|
8248
|
+
);
|
|
8249
|
+
}
|
|
8250
|
+
return address;
|
|
8251
|
+
}
|
|
8252
|
+
function buildBtcSpendRequest712Domain(chainId) {
|
|
8253
|
+
return {
|
|
8254
|
+
name: BTC_SPEND_REQUEST_712_DOMAIN_NAME,
|
|
8255
|
+
version: BTC_SPEND_REQUEST_712_DOMAIN_VERSION,
|
|
8256
|
+
chainId,
|
|
8257
|
+
verifyingContract: btcSpendAuthorizerAddress(chainId)
|
|
8258
|
+
};
|
|
8259
|
+
}
|
|
8260
|
+
function canonicalBtcTxid(txid) {
|
|
8261
|
+
const canonical = String(txid).toLowerCase().replace(/^0x/, "");
|
|
8262
|
+
if (!/^[0-9a-f]{64}$/.test(canonical)) {
|
|
8263
|
+
throw new Error(
|
|
8264
|
+
`Invalid Bitcoin txid "${String(txid)}": expected 64 hex characters (optionally 0x-prefixed)`
|
|
8265
|
+
);
|
|
8266
|
+
}
|
|
8267
|
+
return canonical;
|
|
8268
|
+
}
|
|
8269
|
+
function toBytes32PositionId(positionId) {
|
|
8270
|
+
const hex = positionId.startsWith("0x") ? positionId : `0x${positionId}`;
|
|
8271
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(hex)) {
|
|
8272
|
+
throw new Error(`positionId must be a bytes32 hex string, got "${positionId}"`);
|
|
8273
|
+
}
|
|
8274
|
+
return hex;
|
|
8275
|
+
}
|
|
8276
|
+
var GET_AUTHORIZED_SPENDS_ABI = [
|
|
8277
|
+
"function getAuthorizedSpends(bytes32 positionId) view returns (tuple(string txid, uint32 vout, uint256 satoshis, string targetAddress, uint256 targetAmount, uint256 authorizedAt)[])"
|
|
8278
|
+
];
|
|
8279
|
+
async function readAuthorizedSpend(params) {
|
|
8280
|
+
const authorizer = new import_ethers7.Contract(
|
|
8281
|
+
btcSpendAuthorizerAddress(params.chainId),
|
|
8282
|
+
GET_AUTHORIZED_SPENDS_ABI,
|
|
8283
|
+
params.runner
|
|
8284
|
+
);
|
|
8285
|
+
const positionId = toBytes32PositionId(params.positionId);
|
|
8286
|
+
const wanted = canonicalBtcTxid(params.txid);
|
|
8287
|
+
const spends = await authorizer.getFunction("getAuthorizedSpends").staticCall(positionId);
|
|
8288
|
+
const match2 = spends.find(
|
|
8289
|
+
(s) => String(s.txid).toLowerCase().replace(/^0x/, "") === wanted && Number(s.vout) === Number(params.vout)
|
|
8290
|
+
);
|
|
8291
|
+
if (!match2) {
|
|
8292
|
+
throw new Error(
|
|
8293
|
+
`No on-chain authorized spend for ${params.txid}:${params.vout} under position ${positionId}`
|
|
8294
|
+
);
|
|
8295
|
+
}
|
|
8296
|
+
return {
|
|
8297
|
+
txid: String(match2.txid),
|
|
8298
|
+
vout: Number(match2.vout),
|
|
8299
|
+
satoshis: BigInt(match2.satoshis),
|
|
8300
|
+
targetAddress: String(match2.targetAddress),
|
|
8301
|
+
targetAmount: BigInt(match2.targetAmount),
|
|
8302
|
+
authorizedAt: BigInt(match2.authorizedAt)
|
|
8303
|
+
};
|
|
8304
|
+
}
|
|
8305
|
+
function assertRecordIsOutpoint(record, txid, vout) {
|
|
8306
|
+
if (canonicalBtcTxid(record.txid) !== canonicalBtcTxid(txid) || Number(record.vout) !== Number(vout)) {
|
|
8307
|
+
throw new Error(
|
|
8308
|
+
`The authorized spend record is for ${record.txid}:${record.vout}, not ${txid}:${vout}; refusing to sign`
|
|
8309
|
+
);
|
|
8310
|
+
}
|
|
8311
|
+
}
|
|
8312
|
+
function buildExecuteBtcWithdrawalTypedData(params) {
|
|
8313
|
+
const { networkFee } = params;
|
|
8314
|
+
if (!Number.isSafeInteger(networkFee) || networkFee < 0) {
|
|
8315
|
+
throw new Error(
|
|
8316
|
+
`networkFee must be a non-negative integer number of satoshis, got ${String(networkFee)}`
|
|
8317
|
+
);
|
|
8318
|
+
}
|
|
8319
|
+
const totalDeduction = BigInt(params.record.targetAmount);
|
|
8320
|
+
if (BigInt(networkFee) >= totalDeduction) {
|
|
8321
|
+
throw new Error(
|
|
8322
|
+
`Network fee ${networkFee} sats must be below the authorized total ${totalDeduction.toString()} sats`
|
|
8323
|
+
);
|
|
8324
|
+
}
|
|
8325
|
+
const primaryType = "ExecuteBtcWithdrawalRequest";
|
|
8326
|
+
return {
|
|
8327
|
+
domain: buildBtcSpendRequest712Domain(params.chainId),
|
|
8328
|
+
types: btcSpendRequest712Types(primaryType),
|
|
8329
|
+
primaryType,
|
|
8330
|
+
message: {
|
|
8331
|
+
positionId: toBytes32PositionId(params.positionId),
|
|
8332
|
+
withdrawalAddress: params.record.targetAddress,
|
|
8333
|
+
recipientAmount: (totalDeduction - BigInt(networkFee)).toString(),
|
|
8334
|
+
networkFee: String(networkFee),
|
|
8335
|
+
totalDeduction: totalDeduction.toString(),
|
|
8336
|
+
spendTxid: canonicalBtcTxid(params.record.txid),
|
|
8337
|
+
spendVout: Number(params.record.vout),
|
|
8338
|
+
inputSetHash: params.inputSetHash,
|
|
8339
|
+
quantumTimestamp: String(params.quantumTimestamp)
|
|
8340
|
+
}
|
|
8341
|
+
};
|
|
8342
|
+
}
|
|
8343
|
+
function buildInvalidateStaleSpendTypedData(params) {
|
|
8344
|
+
const primaryType = "InvalidateStaleSpendRequest";
|
|
8345
|
+
return {
|
|
8346
|
+
domain: buildBtcSpendRequest712Domain(params.chainId),
|
|
8347
|
+
types: btcSpendRequest712Types(primaryType),
|
|
8348
|
+
primaryType,
|
|
8349
|
+
message: {
|
|
8350
|
+
positionId: toBytes32PositionId(params.positionId),
|
|
8351
|
+
spendTxid: canonicalBtcTxid(params.record.txid),
|
|
8352
|
+
spendVout: Number(params.record.vout),
|
|
8353
|
+
quantumTimestamp: String(params.quantumTimestamp)
|
|
8354
|
+
}
|
|
8355
|
+
};
|
|
8356
|
+
}
|
|
8357
|
+
function btcSpendRequest712Digest(payload) {
|
|
8358
|
+
return import_ethers7.TypedDataEncoder.hash(payload.domain, payload.types, payload.message);
|
|
8359
|
+
}
|
|
8360
|
+
var BTC_SPEND_QUANTUM_SECONDS = 60;
|
|
8361
|
+
var BTC_SPEND_RELAY_DEADLINE_SECONDS = 90;
|
|
8362
|
+
function quantumStart(nowMs) {
|
|
8363
|
+
return Math.floor(nowMs / 1e3 / BTC_SPEND_QUANTUM_SECONDS) * BTC_SPEND_QUANTUM_SECONDS;
|
|
8364
|
+
}
|
|
8365
|
+
async function signBtcSpendRequest712(signer, build) {
|
|
8366
|
+
let signature;
|
|
8367
|
+
let quantumTimestamp;
|
|
8368
|
+
const restamp = signer.dhRestampTypedData;
|
|
8369
|
+
if (typeof restamp === "function") {
|
|
8370
|
+
({ signature, quantumTimestamp } = await restamp.call(signer, build));
|
|
8371
|
+
} else {
|
|
8372
|
+
const signTypedData = signer.signTypedData;
|
|
8373
|
+
if (typeof signTypedData !== "function") {
|
|
8374
|
+
throw new Error(
|
|
8375
|
+
`Signer has no signTypedData \u2014 cannot produce an EIP-712 BTC spend request. Wallets without typed-data support must supply the signature via an authorizationProvider instead of a connected signer.`
|
|
8376
|
+
);
|
|
8377
|
+
}
|
|
8378
|
+
quantumTimestamp = quantumStart(Date.now());
|
|
8379
|
+
const payload = build(quantumTimestamp);
|
|
8380
|
+
signature = await signTypedData.call(signer, payload.domain, payload.types, payload.message);
|
|
8381
|
+
}
|
|
8382
|
+
const nowMs = Date.now();
|
|
8383
|
+
if (quantumTimestamp > quantumStart(nowMs)) {
|
|
8384
|
+
throw new Error(
|
|
8385
|
+
`The signature is stamped ${quantumTimestamp}, in a quantum that has not started; the Bitcoin signer refuses future stamps. Nothing was submitted.`
|
|
8386
|
+
);
|
|
8387
|
+
}
|
|
8388
|
+
if (nowMs / 1e3 - quantumTimestamp > BTC_SPEND_RELAY_DEADLINE_SECONDS) {
|
|
8389
|
+
throw new Error(
|
|
8390
|
+
`Signed too late: the signature is stamped ${quantumTimestamp}, more than ${BTC_SPEND_RELAY_DEADLINE_SECONDS} s ago, so the Bitcoin signer would refuse it. Nothing was submitted; retry and approve promptly.`
|
|
8391
|
+
);
|
|
8392
|
+
}
|
|
8393
|
+
return { signature, quantumTimestamp, payload: build(quantumTimestamp) };
|
|
8394
|
+
}
|
|
8395
|
+
|
|
8396
|
+
// src/utils/stale-spend-invalidate-message.ts
|
|
8040
8397
|
var RECOVERY_INVALIDATE_ACTION = "btc-utxo-invalidator";
|
|
8041
|
-
var QUANTUM_SECONDS = 60;
|
|
8042
|
-
var QUANTUM_SAFE_THRESHOLD = 40;
|
|
8043
8398
|
function buildInvalidateMessageHash(params) {
|
|
8044
|
-
const positionIdBytes32 = (0,
|
|
8399
|
+
const positionIdBytes32 = (0, import_ethers8.zeroPadValue)(
|
|
8045
8400
|
params.positionId.startsWith("0x") ? params.positionId : `0x${params.positionId}`,
|
|
8046
8401
|
32
|
|
8047
8402
|
);
|
|
8048
|
-
const actionHash = (0,
|
|
8049
|
-
return (0,
|
|
8403
|
+
const actionHash = (0, import_ethers8.keccak256)((0, import_ethers8.toUtf8Bytes)(RECOVERY_INVALIDATE_ACTION));
|
|
8404
|
+
return (0, import_ethers8.solidityPackedKeccak256)(
|
|
8050
8405
|
[
|
|
8051
8406
|
"bytes32",
|
|
8052
8407
|
// positionId
|
|
@@ -8073,32 +8428,29 @@ function buildInvalidateMessageHash(params) {
|
|
|
8073
8428
|
}
|
|
8074
8429
|
async function buildInvalidateStaleSpendEnvelope(params) {
|
|
8075
8430
|
const { positionId, utxoTxid, utxoVout, chainId, signer } = params;
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
if (secsIntoQuantum > QUANTUM_SAFE_THRESHOLD) {
|
|
8081
|
-
const nextQuantumStart = currentQuantumStart + QUANTUM_SECONDS;
|
|
8082
|
-
const waitMs = Math.max(0, (nextQuantumStart - nowSec) * 1e3 + 500);
|
|
8083
|
-
await new Promise((r) => setTimeout(r, waitMs));
|
|
8084
|
-
timestamp = nextQuantumStart;
|
|
8085
|
-
} else {
|
|
8086
|
-
timestamp = currentQuantumStart;
|
|
8431
|
+
if (params.provider === void 0 === (params.authorizedSpend === void 0)) {
|
|
8432
|
+
throw new Error(
|
|
8433
|
+
"buildInvalidateStaleSpendEnvelope: supply exactly one of `provider` or `authorizedSpend` so the outpoint comes from the on-chain record"
|
|
8434
|
+
);
|
|
8087
8435
|
}
|
|
8088
|
-
const
|
|
8089
|
-
|
|
8090
|
-
timestamp,
|
|
8436
|
+
const record = params.authorizedSpend ?? await readAuthorizedSpend({
|
|
8437
|
+
runner: params.provider,
|
|
8091
8438
|
chainId,
|
|
8092
|
-
|
|
8093
|
-
|
|
8439
|
+
positionId,
|
|
8440
|
+
txid: utxoTxid,
|
|
8441
|
+
vout: utxoVout
|
|
8094
8442
|
});
|
|
8095
|
-
|
|
8443
|
+
assertRecordIsOutpoint(record, utxoTxid, utxoVout);
|
|
8444
|
+
const { signature, quantumTimestamp } = await signBtcSpendRequest712(
|
|
8445
|
+
signer,
|
|
8446
|
+
(stamp) => buildInvalidateStaleSpendTypedData({ chainId, positionId, record, quantumTimestamp: stamp })
|
|
8447
|
+
);
|
|
8096
8448
|
const borrowerAddress = await signer.getAddress();
|
|
8097
8449
|
return {
|
|
8098
8450
|
positionId,
|
|
8099
8451
|
utxoTxid,
|
|
8100
8452
|
utxoVout,
|
|
8101
|
-
timestamp,
|
|
8453
|
+
timestamp: quantumTimestamp,
|
|
8102
8454
|
chainId,
|
|
8103
8455
|
action: RECOVERY_INVALIDATE_ACTION,
|
|
8104
8456
|
signature,
|
|
@@ -8107,9 +8459,7 @@ async function buildInvalidateStaleSpendEnvelope(params) {
|
|
|
8107
8459
|
}
|
|
8108
8460
|
|
|
8109
8461
|
// src/utils/btc-withdrawal-message.ts
|
|
8110
|
-
var
|
|
8111
|
-
var QUANTUM_SECONDS2 = 60;
|
|
8112
|
-
var QUANTUM_SAFE_THRESHOLD2 = 40;
|
|
8462
|
+
var import_ethers9 = require("ethers");
|
|
8113
8463
|
function hashBtcInputSet(utxos) {
|
|
8114
8464
|
if (!Array.isArray(utxos) || utxos.length === 0) {
|
|
8115
8465
|
throw new Error("hashBtcInputSet: at least one input is required");
|
|
@@ -8138,26 +8488,31 @@ function hashBtcInputSet(utxos) {
|
|
|
8138
8488
|
seen.add(key);
|
|
8139
8489
|
}
|
|
8140
8490
|
const canonical = normalized.sort((a, b) => a.txid < b.txid ? -1 : a.txid > b.txid ? 1 : a.vout - b.vout).map((u) => `${u.txid}:${u.vout}:${u.value}`).join("|");
|
|
8141
|
-
return (0,
|
|
8491
|
+
return (0, import_ethers9.keccak256)((0, import_ethers9.toUtf8Bytes)(canonical));
|
|
8142
8492
|
}
|
|
8143
8493
|
async function buildBtcExecuteEnvelope(params) {
|
|
8144
|
-
const {
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8494
|
+
const { positionId, txid, vout, satoshis, networkFee, chainId, signer } = params;
|
|
8495
|
+
if (params.provider === void 0 === (params.authorizedSpend === void 0)) {
|
|
8496
|
+
throw new Error(
|
|
8497
|
+
"buildBtcExecuteEnvelope: supply exactly one of `provider` or `authorizedSpend` so the destination and amount come from the on-chain record"
|
|
8498
|
+
);
|
|
8499
|
+
}
|
|
8500
|
+
const record = params.authorizedSpend ?? await readAuthorizedSpend({ runner: params.provider, chainId, positionId, txid, vout });
|
|
8501
|
+
assertRecordIsOutpoint(record, txid, vout);
|
|
8502
|
+
if (params.targetAddress !== void 0 && params.targetAddress !== record.targetAddress) {
|
|
8503
|
+
throw new Error(
|
|
8504
|
+
`buildBtcExecuteEnvelope: destination "${params.targetAddress}" disagrees with the on-chain authorized spend "${record.targetAddress}"; refusing to sign`
|
|
8505
|
+
);
|
|
8506
|
+
}
|
|
8507
|
+
if (params.targetAmount !== void 0 && BigInt(params.targetAmount) !== record.targetAmount) {
|
|
8508
|
+
throw new Error(
|
|
8509
|
+
`buildBtcExecuteEnvelope: amount ${params.targetAmount} sats disagrees with the on-chain authorized spend ${record.targetAmount.toString()} sats; refusing to sign`
|
|
8510
|
+
);
|
|
8157
8511
|
}
|
|
8158
|
-
|
|
8512
|
+
const targetAmount = Number(record.targetAmount);
|
|
8513
|
+
if (!Number.isSafeInteger(targetAmount) || targetAmount <= 0) {
|
|
8159
8514
|
throw new Error(
|
|
8160
|
-
|
|
8515
|
+
`buildBtcExecuteEnvelope: on-chain targetAmount ${record.targetAmount.toString()} is not a positive safe integer`
|
|
8161
8516
|
);
|
|
8162
8517
|
}
|
|
8163
8518
|
const utxos = params.utxos && params.utxos.length > 0 ? params.utxos : [{ txid, vout, value: satoshis }];
|
|
@@ -8170,73 +8525,30 @@ async function buildBtcExecuteEnvelope(params) {
|
|
|
8170
8525
|
`buildBtcExecuteEnvelope: the authorized UTXO ${txid}:${vout} must be part of utxos[]`
|
|
8171
8526
|
);
|
|
8172
8527
|
}
|
|
8173
|
-
const
|
|
8174
|
-
const
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
let timestamp;
|
|
8178
|
-
if (secsIntoQuantum > QUANTUM_SAFE_THRESHOLD2) {
|
|
8179
|
-
const nextQuantumStart = currentQuantumStart + QUANTUM_SECONDS2;
|
|
8180
|
-
const waitMs = Math.max(0, (nextQuantumStart - nowSec) * 1e3 + 500);
|
|
8181
|
-
await new Promise((r) => setTimeout(r, waitMs));
|
|
8182
|
-
timestamp = nextQuantumStart;
|
|
8183
|
-
} else {
|
|
8184
|
-
timestamp = currentQuantumStart;
|
|
8185
|
-
}
|
|
8186
|
-
const actionHash = (0, import_ethers8.keccak256)(
|
|
8187
|
-
(0, import_ethers8.toUtf8Bytes)("execute-btc-withdrawal")
|
|
8188
|
-
);
|
|
8189
|
-
const utxoIdentifier = `${txid}:${vout}`;
|
|
8190
|
-
const positionIdBytes32 = (0, import_ethers8.zeroPadValue)(
|
|
8191
|
-
positionId.startsWith("0x") ? positionId : `0x${positionId}`,
|
|
8192
|
-
32
|
|
8193
|
-
);
|
|
8194
|
-
const messageHash = (0, import_ethers8.solidityPackedKeccak256)(
|
|
8195
|
-
[
|
|
8196
|
-
"bytes32",
|
|
8197
|
-
// positionId
|
|
8198
|
-
"uint256",
|
|
8199
|
-
// timestamp
|
|
8200
|
-
"uint256",
|
|
8201
|
-
// chainId
|
|
8202
|
-
"string",
|
|
8203
|
-
// utxoIdentifier ("txid:vout")
|
|
8204
|
-
"uint256",
|
|
8205
|
-
// networkFee
|
|
8206
|
-
"string",
|
|
8207
|
-
// targetAddress (BTC destination)
|
|
8208
|
-
"uint256",
|
|
8209
|
-
// targetAmount (sats authorized to recipient)
|
|
8210
|
-
"bytes32",
|
|
8211
|
-
// utxosHash (canonical hash of the FULL input set — P6/#8)
|
|
8212
|
-
"bytes32"
|
|
8213
|
-
// actionHash
|
|
8214
|
-
],
|
|
8215
|
-
[
|
|
8216
|
-
positionIdBytes32,
|
|
8217
|
-
timestamp,
|
|
8528
|
+
const inputSetHash = hashBtcInputSet(utxos);
|
|
8529
|
+
const { signature, quantumTimestamp } = await signBtcSpendRequest712(
|
|
8530
|
+
signer,
|
|
8531
|
+
(stamp) => buildExecuteBtcWithdrawalTypedData({
|
|
8218
8532
|
chainId,
|
|
8219
|
-
|
|
8533
|
+
positionId,
|
|
8534
|
+
record,
|
|
8220
8535
|
networkFee,
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
actionHash
|
|
8225
|
-
]
|
|
8536
|
+
inputSetHash,
|
|
8537
|
+
quantumTimestamp: stamp
|
|
8538
|
+
})
|
|
8226
8539
|
);
|
|
8227
|
-
const userSignature = await signer.signMessage((0, import_ethers8.getBytes)(messageHash));
|
|
8228
8540
|
const borrowerAddress = await signer.getAddress();
|
|
8229
8541
|
return {
|
|
8230
8542
|
positionId,
|
|
8231
8543
|
txid,
|
|
8232
8544
|
vout,
|
|
8233
8545
|
satoshis,
|
|
8234
|
-
targetAddress,
|
|
8546
|
+
targetAddress: record.targetAddress,
|
|
8235
8547
|
targetAmount,
|
|
8236
8548
|
networkFee,
|
|
8237
8549
|
chainId,
|
|
8238
|
-
timestamp,
|
|
8239
|
-
userSignature,
|
|
8550
|
+
timestamp: quantumTimestamp,
|
|
8551
|
+
userSignature: signature,
|
|
8240
8552
|
borrowerAddress,
|
|
8241
8553
|
utxos
|
|
8242
8554
|
};
|
|
@@ -8288,7 +8600,7 @@ function maybeTemperSignature(signature, shouldTemper, operationName) {
|
|
|
8288
8600
|
}
|
|
8289
8601
|
|
|
8290
8602
|
// src/utils/address-conversion.utils.ts
|
|
8291
|
-
var
|
|
8603
|
+
var import_ethers10 = require("ethers");
|
|
8292
8604
|
|
|
8293
8605
|
// src/utils/chunks/bitcoin-utils.ts
|
|
8294
8606
|
var import_sha256 = require("@noble/hashes/sha256");
|
|
@@ -8479,6 +8791,8 @@ function isValidBech32Address(address) {
|
|
|
8479
8791
|
const witnessVersion = decoded.words[0];
|
|
8480
8792
|
if (witnessVersion < 0 || witnessVersion > 16)
|
|
8481
8793
|
return false;
|
|
8794
|
+
if (witnessVersion === 0 !== (codec === import_bech32.bech32))
|
|
8795
|
+
return false;
|
|
8482
8796
|
const program = import_bech32.bech32.fromWords(decoded.words.slice(1));
|
|
8483
8797
|
if (program.length < 2 || program.length > 40)
|
|
8484
8798
|
return false;
|
|
@@ -8575,18 +8889,27 @@ function safeValidateBitcoinAddress(address, network) {
|
|
|
8575
8889
|
}
|
|
8576
8890
|
return address;
|
|
8577
8891
|
}
|
|
8892
|
+
var BECH32_PREFIX = /^(bc1|tb1|bcrt1)/i;
|
|
8893
|
+
function bitcoinAddressCaseError(address) {
|
|
8894
|
+
const trimmed = address.trim();
|
|
8895
|
+
if (!BECH32_PREFIX.test(trimmed))
|
|
8896
|
+
return null;
|
|
8897
|
+
if (trimmed === trimmed.toLowerCase() || trimmed === trimmed.toUpperCase())
|
|
8898
|
+
return null;
|
|
8899
|
+
return `Bitcoin address ${trimmed} mixes upper and lower case \u2014 a bech32 address must be entirely one case (BIP-173). Re-copy it from the source.`;
|
|
8900
|
+
}
|
|
8578
8901
|
function normalizeBitcoinAddress(address) {
|
|
8579
8902
|
if (!address || typeof address !== "string")
|
|
8580
8903
|
return address;
|
|
8581
8904
|
const trimmed = address.trim();
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
return trimmed;
|
|
8905
|
+
const caseError = bitcoinAddressCaseError(trimmed);
|
|
8906
|
+
if (caseError)
|
|
8907
|
+
throw new Error(caseError);
|
|
8908
|
+
return BECH32_PREFIX.test(trimmed) ? trimmed.toLowerCase() : trimmed;
|
|
8586
8909
|
}
|
|
8587
8910
|
|
|
8588
8911
|
// src/protocol/protocol-pause.ts
|
|
8589
|
-
var
|
|
8912
|
+
var import_ethers11 = require("ethers");
|
|
8590
8913
|
var GET_PROTOCOL_PAUSE_STATUS_ABI = [
|
|
8591
8914
|
"function getProtocolPauseStatus() view returns (tuple(bool positionManagerPaused, bool positionManagerLiquidationsPaused, bool positionManagerCorePaused, bool loanOperationsPaused, bool collateralManagerPaused, bool liquidationManagerPaused, bool circuitBreakerPaused, bool ucdControllerPaused, bool ucdTokenPaused, bool simplePsmPaused))"
|
|
8592
8915
|
];
|
|
@@ -8608,7 +8931,7 @@ function rowToStatus(row) {
|
|
|
8608
8931
|
return row;
|
|
8609
8932
|
}
|
|
8610
8933
|
async function fetchProtocolPauseStatus(provider, positionManagerAddress) {
|
|
8611
|
-
const iface = new
|
|
8934
|
+
const iface = new import_ethers11.Interface(GET_PROTOCOL_PAUSE_STATUS_ABI);
|
|
8612
8935
|
const data = iface.encodeFunctionData("getProtocolPauseStatus", []);
|
|
8613
8936
|
const raw = await provider.call({ to: positionManagerAddress, data });
|
|
8614
8937
|
const decoded = iface.decodeFunctionResult("getProtocolPauseStatus", raw);
|
|
@@ -8741,7 +9064,7 @@ function extractOptionalLitSignature(raw) {
|
|
|
8741
9064
|
}
|
|
8742
9065
|
|
|
8743
9066
|
// src/modules/contract/contract-manager.module.ts
|
|
8744
|
-
var
|
|
9067
|
+
var import_ethers12 = require("ethers");
|
|
8745
9068
|
init_deployment_addresses();
|
|
8746
9069
|
var POSITION_MANAGER_ABI = [
|
|
8747
9070
|
"function createPosition(bytes32 pkpId, bytes calldata validatorSignature, string mainnetVaultAddress, string regtestVaultAddress, uint256 selectedTermMonths, uint256 validatorVersion, bytes calldata pkpPublicKey) external returns (bytes32 positionId)",
|
|
@@ -8815,38 +9138,38 @@ var ContractManager = class {
|
|
|
8815
9138
|
}
|
|
8816
9139
|
const contractRunner = runner;
|
|
8817
9140
|
const contracts = {
|
|
8818
|
-
positionManager: new
|
|
9141
|
+
positionManager: new import_ethers12.Contract(
|
|
8819
9142
|
contractAddresses.positionManager,
|
|
8820
9143
|
POSITION_MANAGER_ABI,
|
|
8821
9144
|
contractRunner
|
|
8822
9145
|
),
|
|
8823
|
-
loanOperationsManager: new
|
|
8824
|
-
contractAddresses.loanOperationsManager ||
|
|
9146
|
+
loanOperationsManager: new import_ethers12.Contract(
|
|
9147
|
+
contractAddresses.loanOperationsManager || import_ethers12.ZeroAddress,
|
|
8825
9148
|
LOAN_OPS_ABI,
|
|
8826
9149
|
contractRunner
|
|
8827
9150
|
),
|
|
8828
|
-
ucdController: new
|
|
9151
|
+
ucdController: new import_ethers12.Contract(
|
|
8829
9152
|
contractAddresses.ucdToken,
|
|
8830
9153
|
UCD_CONTROLLER_ABI,
|
|
8831
9154
|
contractRunner
|
|
8832
9155
|
),
|
|
8833
|
-
termManager: new
|
|
8834
|
-
contractAddresses.termManager ||
|
|
9156
|
+
termManager: new import_ethers12.Contract(
|
|
9157
|
+
contractAddresses.termManager || import_ethers12.ZeroAddress,
|
|
8835
9158
|
TERM_MANAGER_ABI,
|
|
8836
9159
|
contractRunner
|
|
8837
9160
|
),
|
|
8838
|
-
circuitBreaker: new
|
|
8839
|
-
contractAddresses.circuitBreaker ||
|
|
9161
|
+
circuitBreaker: new import_ethers12.Contract(
|
|
9162
|
+
contractAddresses.circuitBreaker || import_ethers12.ZeroAddress,
|
|
8840
9163
|
CIRCUIT_BREAKER_ABI,
|
|
8841
9164
|
contractRunner
|
|
8842
9165
|
),
|
|
8843
|
-
liquidationManager: new
|
|
8844
|
-
contractAddresses.liquidationManager ||
|
|
9166
|
+
liquidationManager: new import_ethers12.Contract(
|
|
9167
|
+
contractAddresses.liquidationManager || import_ethers12.ZeroAddress,
|
|
8845
9168
|
LIQUIDATION_MANAGER_ABI,
|
|
8846
9169
|
contractRunner
|
|
8847
9170
|
),
|
|
8848
|
-
bitcoinWithdrawalAddressRegistry: new
|
|
8849
|
-
contractAddresses.bitcoinWithdrawalAddressRegistry ||
|
|
9171
|
+
bitcoinWithdrawalAddressRegistry: new import_ethers12.Contract(
|
|
9172
|
+
contractAddresses.bitcoinWithdrawalAddressRegistry || import_ethers12.ZeroAddress,
|
|
8850
9173
|
BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY_ABI,
|
|
8851
9174
|
contractRunner
|
|
8852
9175
|
)
|
|
@@ -8895,13 +9218,13 @@ var ContractManager = class {
|
|
|
8895
9218
|
const address = addresses[key];
|
|
8896
9219
|
if (!address) {
|
|
8897
9220
|
missing.push(String(key));
|
|
8898
|
-
} else if (!(0,
|
|
9221
|
+
} else if (!(0, import_ethers12.isAddress)(address)) {
|
|
8899
9222
|
invalid.push(String(key));
|
|
8900
9223
|
}
|
|
8901
9224
|
}
|
|
8902
9225
|
for (const key of optionalAddresses) {
|
|
8903
9226
|
const address = addresses[key];
|
|
8904
|
-
if (address && !(0,
|
|
9227
|
+
if (address && !(0, import_ethers12.isAddress)(address)) {
|
|
8905
9228
|
invalid.push(String(key));
|
|
8906
9229
|
}
|
|
8907
9230
|
}
|
|
@@ -9867,7 +10190,7 @@ function createPKPManager(config) {
|
|
|
9867
10190
|
}
|
|
9868
10191
|
|
|
9869
10192
|
// src/modules/loan/loan-creator.module.ts
|
|
9870
|
-
var
|
|
10193
|
+
var import_ethers13 = require("ethers");
|
|
9871
10194
|
var import_dh_lit_actions = __toESM(require_pkg_src());
|
|
9872
10195
|
|
|
9873
10196
|
// src/utils/contract-wallet.utils.ts
|
|
@@ -10226,11 +10549,11 @@ var LoanCreator = class {
|
|
|
10226
10549
|
try {
|
|
10227
10550
|
const mainnetVaultAddress = bitcoinAddresses.mainnet;
|
|
10228
10551
|
const regtestVaultAddress = bitcoinAddresses.regtest;
|
|
10229
|
-
const pkpIdBytes32 = (0,
|
|
10230
|
-
(0,
|
|
10552
|
+
const pkpIdBytes32 = (0, import_ethers13.zeroPadValue)(
|
|
10553
|
+
(0, import_ethers13.toBeHex)(BigInt(pkpData.tokenId)),
|
|
10231
10554
|
32
|
|
10232
10555
|
);
|
|
10233
|
-
const pkpPublicKeyUncompressed =
|
|
10556
|
+
const pkpPublicKeyUncompressed = import_ethers13.SigningKey.computePublicKey(
|
|
10234
10557
|
pkpData.publicKey,
|
|
10235
10558
|
false
|
|
10236
10559
|
);
|
|
@@ -10243,7 +10566,7 @@ var LoanCreator = class {
|
|
|
10243
10566
|
);
|
|
10244
10567
|
log.debug(`BigInt conversion: ${BigInt(pkpData.tokenId).toString()}`);
|
|
10245
10568
|
log.debug(
|
|
10246
|
-
`Hex from BigInt: ${(0,
|
|
10569
|
+
`Hex from BigInt: ${(0, import_ethers13.toBeHex)(BigInt(pkpData.tokenId))}`
|
|
10247
10570
|
);
|
|
10248
10571
|
log.debug(`Final bytes32 (zero-padded): ${pkpIdBytes32}`);
|
|
10249
10572
|
log.debug(
|
|
@@ -10415,8 +10738,8 @@ var LoanCreator = class {
|
|
|
10415
10738
|
}
|
|
10416
10739
|
}
|
|
10417
10740
|
if (this.config.debug) {
|
|
10418
|
-
const pkpIdBytes32Check = (0,
|
|
10419
|
-
(0,
|
|
10741
|
+
const pkpIdBytes32Check = (0, import_ethers13.zeroPadValue)(
|
|
10742
|
+
(0, import_ethers13.toBeHex)(BigInt(pkpData.tokenId)),
|
|
10420
10743
|
32
|
|
10421
10744
|
);
|
|
10422
10745
|
log.error("\u274C Loan creation transaction failed", {
|
|
@@ -10577,7 +10900,7 @@ var LoanCreator = class {
|
|
|
10577
10900
|
const coreAddress = this.config.contractManager.getContractAddresses().positionManagerCore;
|
|
10578
10901
|
if (coreAddress) {
|
|
10579
10902
|
try {
|
|
10580
|
-
const core = new
|
|
10903
|
+
const core = new import_ethers13.Contract(
|
|
10581
10904
|
coreAddress,
|
|
10582
10905
|
[
|
|
10583
10906
|
"function getPositionDetails(bytes32) view returns (tuple(bytes32 positionId, bytes32 pkpId, uint256 ucdDebt, string vaultAddress, address borrower, uint40 createdAt, uint40 lastUpdated, uint16 selectedTerm, uint40 expiryAt, uint8 status))"
|
|
@@ -10619,8 +10942,8 @@ var LoanCreator = class {
|
|
|
10619
10942
|
const newEventAbi = [
|
|
10620
10943
|
"event PositionCreated(bytes32 indexed positionId, bytes32 indexed pkpId, address indexed borrower, uint256 requestedCollateralRatio, uint256 selectedTerm, uint256 expiryAt)"
|
|
10621
10944
|
];
|
|
10622
|
-
const oldIface = new
|
|
10623
|
-
const newIface = new
|
|
10945
|
+
const oldIface = new import_ethers13.Interface(oldEventAbi);
|
|
10946
|
+
const newIface = new import_ethers13.Interface(newEventAbi);
|
|
10624
10947
|
let positionId;
|
|
10625
10948
|
if (this.config.debug) {
|
|
10626
10949
|
log.info("\u{1F50D} Parsing transaction receipt logs", {
|
|
@@ -10714,7 +11037,7 @@ var LoanStatus = /* @__PURE__ */ ((LoanStatus2) => {
|
|
|
10714
11037
|
})(LoanStatus || {});
|
|
10715
11038
|
|
|
10716
11039
|
// src/modules/loan/loan-query.module.ts
|
|
10717
|
-
var
|
|
11040
|
+
var import_ethers14 = require("ethers");
|
|
10718
11041
|
|
|
10719
11042
|
// src/constants/chunks/sdk-limits.ts
|
|
10720
11043
|
var THE_GRAPH_MAX_BATCH_SIZE = 1e3;
|
|
@@ -11111,7 +11434,7 @@ var LoanQuery = class {
|
|
|
11111
11434
|
const isChipotlePkpId2 = typeof rawId === "string" && isNormalizedChipotlePkpId(rawId);
|
|
11112
11435
|
if (isChipotlePkpId2) {
|
|
11113
11436
|
if (this.config.positionManagerCoreAddress && this.config.provider) {
|
|
11114
|
-
const pmContract = new
|
|
11437
|
+
const pmContract = new import_ethers14.Contract(
|
|
11115
11438
|
this.config.positionManagerCoreAddress,
|
|
11116
11439
|
POSITION_CORE_ABI,
|
|
11117
11440
|
this.config.provider
|
|
@@ -11214,7 +11537,7 @@ var LoanQuery = class {
|
|
|
11214
11537
|
*/
|
|
11215
11538
|
async getBorrowerUcdDebtSummary(borrower) {
|
|
11216
11539
|
const trimmed = typeof borrower === "string" ? borrower.trim() : "";
|
|
11217
|
-
if (!(0,
|
|
11540
|
+
if (!(0, import_ethers14.isAddress)(trimmed)) {
|
|
11218
11541
|
return failure(
|
|
11219
11542
|
new SDKError({
|
|
11220
11543
|
message: `Borrower must be an EVM address for a UCD debt summary, got "${trimmed}"`,
|
|
@@ -11471,7 +11794,7 @@ function createLoanQuery(config) {
|
|
|
11471
11794
|
}
|
|
11472
11795
|
|
|
11473
11796
|
// src/modules/withdrawal-address/withdrawal-address.module.ts
|
|
11474
|
-
var
|
|
11797
|
+
var import_ethers15 = require("ethers");
|
|
11475
11798
|
var STATIC_CALL_DIAGNOSTIC_TIMEOUT_MS = 5e3;
|
|
11476
11799
|
var WithdrawalAddressModule = class {
|
|
11477
11800
|
config;
|
|
@@ -11489,7 +11812,7 @@ var WithdrawalAddressModule = class {
|
|
|
11489
11812
|
if (!res.success)
|
|
11490
11813
|
return res;
|
|
11491
11814
|
const target = res.value.target;
|
|
11492
|
-
if (!target || target ===
|
|
11815
|
+
if (!target || target === import_ethers15.ZeroAddress) {
|
|
11493
11816
|
return failure(
|
|
11494
11817
|
new SDKError({
|
|
11495
11818
|
code: "SDK_WITHDRAWAL_REGISTRY_NOT_CONFIGURED",
|
|
@@ -11505,9 +11828,31 @@ var WithdrawalAddressModule = class {
|
|
|
11505
11828
|
isConfigured() {
|
|
11506
11829
|
return this.getRegistry().success;
|
|
11507
11830
|
}
|
|
11508
|
-
/**
|
|
11831
|
+
/**
|
|
11832
|
+
* keccak256 of the canonicalized address — matches the on-chain key.
|
|
11833
|
+
* @throws on mixed-case bech32, which has no canonical spelling (BIP-173).
|
|
11834
|
+
*/
|
|
11509
11835
|
static addressHash(btcAddress) {
|
|
11510
|
-
return (0,
|
|
11836
|
+
return (0, import_ethers15.keccak256)((0, import_ethers15.toUtf8Bytes)(normalizeBitcoinAddress(btcAddress)));
|
|
11837
|
+
}
|
|
11838
|
+
/**
|
|
11839
|
+
* The canonical spelling the registry keys on, or a VALIDATION failure for mixed-case
|
|
11840
|
+
* bech32 — reported as a value, like every other failure of this module, never thrown.
|
|
11841
|
+
*/
|
|
11842
|
+
canonicalAddress(btcAddress) {
|
|
11843
|
+
const caseError = bitcoinAddressCaseError(btcAddress);
|
|
11844
|
+
if (caseError) {
|
|
11845
|
+
return failure(
|
|
11846
|
+
new SDKError({
|
|
11847
|
+
code: "SDK_INVALID_BITCOIN_ADDRESS",
|
|
11848
|
+
message: caseError,
|
|
11849
|
+
category: "VALIDATION" /* VALIDATION */,
|
|
11850
|
+
severity: "MEDIUM" /* MEDIUM */,
|
|
11851
|
+
context: { btcAddress }
|
|
11852
|
+
})
|
|
11853
|
+
);
|
|
11854
|
+
}
|
|
11855
|
+
return success(normalizeBitcoinAddress(btcAddress));
|
|
11511
11856
|
}
|
|
11512
11857
|
/**
|
|
11513
11858
|
* Add a Bitcoin address to the caller's allowlist. It becomes usable only
|
|
@@ -11517,7 +11862,10 @@ var WithdrawalAddressModule = class {
|
|
|
11517
11862
|
const reg = this.getRegistry();
|
|
11518
11863
|
if (!reg.success)
|
|
11519
11864
|
return reg;
|
|
11520
|
-
const
|
|
11865
|
+
const canonical = this.canonicalAddress(btcAddress);
|
|
11866
|
+
if (!canonical.success)
|
|
11867
|
+
return canonical;
|
|
11868
|
+
const normalized = canonical.value;
|
|
11521
11869
|
try {
|
|
11522
11870
|
const tx = await reg.value.addAddress(normalized);
|
|
11523
11871
|
return success(tx);
|
|
@@ -11535,7 +11883,10 @@ var WithdrawalAddressModule = class {
|
|
|
11535
11883
|
const reg = this.getRegistry();
|
|
11536
11884
|
if (!reg.success)
|
|
11537
11885
|
return reg;
|
|
11538
|
-
const
|
|
11886
|
+
const canonical = this.canonicalAddress(btcAddress);
|
|
11887
|
+
if (!canonical.success)
|
|
11888
|
+
return canonical;
|
|
11889
|
+
const normalized = canonical.value;
|
|
11539
11890
|
try {
|
|
11540
11891
|
const tx = await reg.value.removeAddress(normalized);
|
|
11541
11892
|
return success(tx);
|
|
@@ -11556,11 +11907,11 @@ var WithdrawalAddressModule = class {
|
|
|
11556
11907
|
const reg = this.getRegistry();
|
|
11557
11908
|
if (!reg.success)
|
|
11558
11909
|
return reg;
|
|
11910
|
+
const canonical = this.canonicalAddress(btcAddress);
|
|
11911
|
+
if (!canonical.success)
|
|
11912
|
+
return canonical;
|
|
11559
11913
|
try {
|
|
11560
|
-
const ok = await reg.value.isApproved(
|
|
11561
|
-
user,
|
|
11562
|
-
normalizeBitcoinAddress(btcAddress)
|
|
11563
|
-
);
|
|
11914
|
+
const ok = await reg.value.isApproved(user, canonical.value);
|
|
11564
11915
|
return success(ok);
|
|
11565
11916
|
} catch (error) {
|
|
11566
11917
|
return this.txFailure("isApproved", error, btcAddress);
|
|
@@ -14973,7 +15324,7 @@ var DiamondHandsGraph = class {
|
|
|
14973
15324
|
};
|
|
14974
15325
|
|
|
14975
15326
|
// src/contracts/typechain-contracts/factories/src/psm/SimplePSMV2__factory.ts
|
|
14976
|
-
var
|
|
15327
|
+
var import_ethers16 = require("ethers");
|
|
14977
15328
|
var _abi = [
|
|
14978
15329
|
{
|
|
14979
15330
|
inputs: [],
|
|
@@ -17541,7 +17892,7 @@ var _abi = [
|
|
|
17541
17892
|
];
|
|
17542
17893
|
var _bytecode = "0x60a080604052346100ea57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c166100d9576002600160401b03196001600160401b03821601610073575b60405161485a90816100f0823960805181818161278e01526128870152f35b6001600160401b0319166001600160401b039081177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880610054565b63f92ee8a960e01b60005260046000fd5b600080fdfe6080604052600436101561001257600080fd5b6000803560e01c8062f7fce91461384657806301ffc9a7146137d5578063021d28931461377c5780630871b20614613743578063114249d214610f6157806311d954f81461371a57806313da3166146136e15780631d44a904146136385780631f77bf65146135ff578063248a9ca3146135e05780632b83cccd146131205780632f2ff15d146130ee57806334bac370146130b557806334e181251461307c57806336568abe14613037578063373c86b614612ffe5780633f4ba83a14612f375780634373b57214612f0e5780634451e89b14612b3a5780634ebd25a514612b015780634f1ef2861461280c5780635273b6f6146127e357806352d1902d1461277b578063568fafca146126ed57806359d5d02a146124205780635bc26aea146123eb5780635c975abb146123bb5780635ecc27081461229d5780638456cb59146121a257806385c15d9a1461216957806389d3ad00146120a25780638bff608e146120695780639010d07c1461201657806390ad8b4014611ffa57806391d1485414611fa15780639b759bf714611f5e5780639baf58d214611f415780639f1d0f59146118a8578063a217fddf1461188c578063a3246ad3146117cf578063ad3cb1cc14611788578063b492fc691461168e578063b9f637af14611463578063bf7d911914611424578063c4c5f62414611371578063c55f15ea1461134e578063ca15c87314611317578063ca2ce65d146112de578063cc1f8ffa146112ac578063cf46075e146111a2578063d21a74ff14611165578063d2f8253614611142578063d547741f14611107578063d5d3f78b14610f9a578063d66bd52414610f61578063e1f1c4a714610f44578063e1f3962c14610f18578063ec2f96fe14610ef4578063eda5a26a14610af7578063f1a1eb8414610ab4578063f385116d14610a7b578063f77c479114610a54578063f8c8765e14610661578063faaebd2114610628578063facdfb5e14610488578063fc99bd9a14610377578063fe32e7281461033e5763ffa1ad741461030857600080fd5b3461033b578060031936011261033b57610337610323613a68565b604051918291602083526020830190613a17565b0390f35b80fd5b503461033b57602036600319011261033b576020906040906001600160a01b0361036661392e565b168152601283522054604051908152f35b503461033b57604036600319011261033b5761039161392e565b6010546024359291906001600160a01b03163303610479576001600160a01b03168082526002602052604082205490929060ff16156104665780156104575782825260076020526040822054926103e88285613cb0565b848110610448576001600160ff1b0381116104395760008051602061482e833981519152604085968493846104369852600760205280838a205582519182526020820152a23090339061421c565b80f35b630700fcb360e11b8452600484fd5b63446c8cc960e01b8452600484fd5b63162908e360e11b8252600482fd5b506024916374ed46ad60e01b8252600452fd5b6349db3bd360e01b8252600482fd5b503461033b57602036600319011261033b576104a261392e565b6104aa613f12565b6010546001600160a01b03163303610479576001600160a01b03168082526002602052604082205460ff161561061657808252600760205260408220546040516370a0823160e01b8152306004820152602081602481865afa90811561060b5784916105d4575b50818111156105c5576105248282613b6c565b8215908115610570575b505060008051602061482e833981519152916040918486526007602052808387205582519182526020820152a260016000805160206147ce8339815191525580f35b61271081029080820461271014901517156105b157606484029184830460641417156105b157116105a257388061052e565b63a73af74d60e01b8452600484fd5b634e487b7160e01b86526011600452602486fd5b6105cf8183613b6c565b610524565b90506020813d602011610603575b816105ef602093836139c3565b810103126105fe575138610511565b600080fd5b3d91506105e2565b6040513d86823e3d90fd5b6374ed46ad60e01b8252600452602490fd5b503461033b57602036600319011261033b576020906040906001600160a01b0361065061392e565b168152600483522054604051908152f35b503461033b57608036600319011261033b5761067b61392e565b610683613944565b6044356001600160a01b03811690818103610a50576064356001600160a01b0381169390849003610a4c5760008051602061480e83398151915254604081901c60ff161595906001600160401b031680159081610a44575b6001149081610a3a575b159081610a31575b50610a225760008051602061480e83398151915280546001600160401b0319166001179055856109fd575b6001600160a01b03169081156109ee576001600160a01b03169081156109df5783156109d05761074661448a565b61074e61448a565b61075661448a565b61075e61448a565b60016000805160206147ce8339815191525561077861448a565b61078061448a565b86546001600160a01b0319908116919091178755600180549182168317905560405163313ce56760e01b8152909190602081600481855afa88918161099f575b506107d457633a24e95b60e11b8852600488fd5b6001600160a81b03199092161760a091821b60ff60a01b16176001819055901c60ff16601119810161098d575061080b8186614348565b80610965575b156109205761082e816000805160206147ee833981519152614348565b8061092f575b15610920576108519060008051602061470e833981519152614348565b90816108e9575b50156108da57806108af575b5061086c5780f35b60ff60401b1960008051602061480e833981519152541660008051602061480e833981519152556000805160206146ee833981519152602060405160018152a180f35b601080546001600160a01b031916821790558260008051602061474e8339815191528180a338610864565b63cf5a8e3360e01b8352600483fd5b6109199060008051602061470e83398151915286526000805160206146ae833981519152602052604086206144d0565b5038610858565b63cf5a8e3360e01b8552600485fd5b6000805160206147ee83398151915286526000805160206146ae83398151915260205261095f83604088206144d0565b50610834565b8580526000805160206146ae83398151915260205261098783604088206144d0565b50610811565b63167738cf60e21b8652600452602485fd5b6109c291925060203d6020116109c9575b6109ba81836139c3565b810190613ba9565b90386107c0565b503d6109b0565b630b5eba9f60e41b8752600487fd5b63c1ab6dc160e01b8752600487fd5b6336abb4df60e11b8752600487fd5b60008051602061480e833981519152805460ff60401b1916600160401b179055610718565b63f92ee8a960e01b8752600487fd5b905015386106ed565b303b1591506106e5565b8791506106db565b8580fd5b8480fd5b503461033b578060031936011261033b57546040516001600160a01b039091168152602090f35b503461033b57602036600319011261033b576020906040906001600160a01b03610aa361392e565b168152600a83522054604051908152f35b503461033b57604036600319011261033b576020906040906001600160a01b03610adc61392e565b16815260158352818120602435825283522054604051908152f35b503461033b5761016036600319011261033b57610b1261392e565b90606435604435602435610b24613a58565b9160a4359160c43560e43561010435916101243595610144359760018060a01b03601054163303610ee5576001600160a01b038c16808c52600260205260408c2054909a9060ff16610ed1578a15610ec2578615610eb3576127108811610e99576103e88111610e815760ff82169c60128e118e8115610e76575b50610e6257803b15610e4e578915610e3a578a15610e265782610bc191614260565b84151580610e1d575b610e065785151580610dfd575b610de6578b9c602460208d9e9d604051928380926370a0823160e01b82523060048301525afa9c8d15610dda579c610da6575b506001600160ff1b038c11610d97578a8d8f9760408f97838f918f8f8f8f90859f988f99879f9660008051602061476e8339815191529f978b9f988f8d6000805160206146ce8339815191529f988e8e610d4f9b60008051602061468e8339815191529f8f8f8487526002602052878720600160ff198254161790558487526003602052878720558386526004602052868620558285526006602052878686205582855260056020528585209060ff19825416179055818452600c6020528885852055818452600d6020528985852055818452600e6020528a85852055818452600f6020528b8585205581845260076020528484205582526012602052828220558d8152601360205220558a7f991d1ef1b5c0820d213328cba6682059e00a50e49c469a454eb3557e78eaf6668e80518b81528c6020820152a28c5198899889613cbd565b0390a28151908b82526020820152a28151908782526020820152a280610d73578280f35b604060008051602061482e833981519152918151908582526020820152a281808280f35b63556e7a8160e01b8e5260048efd5b909b506020813d602011610dd2575b81610dc2602093836139c3565b810103126105fe57519a38610c0a565b3d9150610db5565b604051903d90823e3d90fd5b60448c858863dd85772b60e01b8352600452602452fd5b50838610610bd7565b60448c8487637449915760e01b8352600452602452fd5b50828510610bca565b636835314760e11b8d52600160045260248dfd5b636835314760e11b8d5260048d905260248dfd5b63377e3f9960e21b8d5260048c905260248dfd5b63ca95039160e01b8d5260048e905260248dfd5b60069150108e610b9f565b631051834f60e11b8c526004526103e860245260448bfd5b63c1e9a14160e01b8c52600488905261271060245260448cfd5b63a2ec3a5560e01b8c5260048cfd5b63df407ac560e01b8c5260048cfd5b6317f4215b60e21b8c5260048b905260248cfd5b6349db3bd360e01b8b5260048bfd5b503461033b578060031936011261033b57602060ff60015460a01c16604051908152f35b503461033b57602036600319011261033b576020610f3c610f3761392e565b613df5565b604051908152f35b503461033b578060031936011261033b5760206040516127108152f35b503461033b57602036600319011261033b576020906040906001600160a01b03610f8961392e565b168152600783522054604051908152f35b503461033b57602036600319011261033b57610fb461392e565b6010546001600160a01b03163303610479576001600160a01b03168082526002602052604082205460ff16156106165780825260076020526040822054806110f1575080825260026020526040822060ff1981541690558082526003602052816040812055808252600460205281604081205580825260056020526040822060ff198154169055808252600c602052816040812055808252600d602052816040812055808252600e602052816040812055808252600f602052816040812055808252600660205281604081205580825260076020526040822054818352600760205282604081205560405190827f3302a1b37f04242bb55603f5449e7ecd690a35eef08ba1353c48c20e2aae9cda8580a2806110ce578380f35b8160409160008051602061482e8339815191529352846020820152a23880808380f35b604492916376bc059760e11b8352600452602452fd5b503461033b57604036600319011261033b5761113e600435611127613944565b9061113961113482613b79565b614088565b61411a565b5080f35b503461033b578060031936011261033b57602060ff600854166040519015158152f35b503461033b57602036600319011261033b5760209060ff906040906001600160a01b0361119061392e565b16815260058452205416604051908152f35b503461033b57602036600319011261033b576111bc61392e565b6111c4613f12565b6010546001600160a01b03163303610479576001600160a01b03168082526002602052604082205460ff161561061657808252600760205260408220546040516370a0823160e01b8152306004820152602081602481865afa90811561060b57849161126c575b5060008051602061482e833981519152916040918486526007602052808387205582519182526020820152a260016000805160206147ce8339815191525580f35b90506020813d6020116112a4575b81611287602093836139c3565b810103126105fe575160008051602061482e83398151915261122b565b3d915061127a565b503461033b57604036600319011261033b5760206112d46112cb61392e565b60243590613cf6565b6040519015158152f35b503461033b57602036600319011261033b576020906040906001600160a01b0361130661392e565b168152601383522054604051908152f35b503461033b57602036600319011261033b57604060209160043581526000805160206146ae83398151915283522054604051908152f35b503461033b578060031936011261033b576020604051670de0b6b3a76400008152f35b503461033b57604036600319011261033b5761138b61392e565b6010546024359291906001600160a01b03163303610479576001600160a01b031680825260076020526040822054929081841061140d578060008051602061482e8339815191526040866113e3866104369899613b6c565b84895260076020528289205583885260076020528188205482519182526020820152a2339061404c565b5091604492633cb8e07360e01b8352600452602452fd5b503461033b57602036600319011261033b5760209060ff906040906001600160a01b0361144f61392e565b168152600284522054166040519015158152f35b503461033b5761012036600319011261033b5761147e61392e565b6064359190604435602435611491613a58565b601054610104359660e4359260c4359260a43592906001600160a01b0316330361167f576001600160a01b038816808a52600260205260408a205490989060ff161561166b57861561165c576127108811611642576103e882116116285760ff83169060128211801561161e575b61160a578361150d91614260565b85151580611601575b6115ea578a1515806115e1575b6115ca579260008051602061468e83398151915297969592828c956115c4979460408e8e80825260036020528c8383205580825260046020528d838320558152600660205220558b8d52600560205260408d209060ff198254161790558a8c52600c6020528260408d20558a8c52600d6020528360408d20558a8c52600e6020528460408d20558a8c52600f6020528560408d205560405198899889613cbd565b0390a280f35b60448a868d63dd85772b60e01b8352600452602452fd5b50848b10611523565b60448a8588637449915760e01b8352600452602452fd5b50838610611516565b63ca95039160e01b8b52600482905260248bfd5b50600682106114ff565b631051834f60e11b8a5260048290526103e860245260448afd5b63c1e9a14160e01b8a52600488905261271060245260448afd5b63a2ec3a5560e01b8a5260048afd5b6374ed46ad60e01b8a52600489905260248afd5b6349db3bd360e01b8952600489fd5b503461033b57604036600319011261033b576116a861392e565b6001600160a01b0316808252600260205260408220546024359060ff16156117745780156117655761271061172a604085670de0b6b3a76400006117196117329688859a52600560205260ff85852054169080916012811061173f575b505088845260036020528484205490613a8b565b049581526004602052205484613a8b565b048092613b6c565b9082519182526020820152f35b61175e925060ff61175261175892613ad4565b16613ae5565b90613a8b565b3880611705565b63162908e360e11b8352600483fd5b6374ed46ad60e01b83526004829052602483fd5b503461033b578060031936011261033b5761033760408051906117ab81836139c3565b60058252640352e302e360dc1b602083015251918291602083526020830190613a17565b503461033b57602036600319011261033b5760043581526000805160206146ae83398151915260205260408120604051908160208254918281520190819285526020852090855b818110611876575050508261182c9103836139c3565b604051928392602084019060208552518091526040840192915b818110611854575050500390f35b82516001600160a01b0316845285945060209384019390920191600101611846565b8254845260209093019260019283019201611816565b503461033b578060031936011261033b57602090604051908152f35b503461033b576118b736613969565b9190926118c2613f12565b6118ca613f4e565b338152600960205260408120544303611f1f57338152600a602052600360408220541015611f1057338152600a602052604081206119088154613b9a565b90555b6001600160a01b0382168082526002602052604082205490929060ff16611e6f575b828252600260205260ff60408320541615610466578415610457578315611e6057828252600c60205260408220548510611e3b57828252600e60205260408220548015611e2c57808611611e155750846119869161415e565b6040516370a0823160e01b8152306004820152602081602481865afa908115611e0a578291611dd8575b506119bd8530338661421c565b6040516370a0823160e01b8152306004820152602081602481875afa908115611cef57908692918491611d9f575b50906119f691613b6c565b10611d905781815260076020526040812054611a128582613cb0565b818110611d81576001600160ff1b038111611d72576040849260008051602061482e833981519152928486526007602052808387205582519182526020820152a2818152600560205260ff604082205416849060128110611d11575b50611a8f670de0b6b3a7640000918484526003602052604084205490613a8b565b04908281526004602052612710611aaa604083205484613a8b565b0491611ab68382613b6c565b94808610611cfa57506001546040516318160ddd60e01b815290602090829060049082906001600160a01b03165afa908115611cef578391611cbd575b5082546001600160a01b0316803b15611ca45783809160846040518094819363ae494fa160e01b83523360048401528c60248401528b60448401528d60648401525af1801561060b57908491611ca8575b505083611c34575b6001546040516318160ddd60e01b81529190602090839060049082906001600160a01b03165afa801561060b578490611c00575b611b8a9250613b6c565b90808203611bea575050507fb3e2773606abfd36b5bd91394b3a54d1398336c65005baf7bf7a05efeffaf75b611bcd602095604051918291339588429285613bdd565b0390a360016000805160206147ce83398151915255604051908152f35b632d8562a360e11b835260045260245260449150fd5b506020823d602011611c2c575b81611c1a602093836139c3565b810103126105fe57611b8a9151611b80565b3d9150611c0d565b82546001600160a01b0316803b15611ca45783809160846040518094819363ae494fa160e01b83523060048401528a60248401528b60448401528160648401525af1801561060b57908491611c8b575b5050611b4c565b81611c95916139c3565b611ca0578238611c84565b8280fd5b8380fd5b81611cb2916139c3565b611ca0578238611b44565b90506020813d602011611ce7575b81611cd8602093836139c3565b810103126105fe575138611af3565b3d9150611ccb565b6040513d85823e3d90fd5b6371c4efed60e01b83526004869052602452604482fd5b611d21915061175260ff91613ad4565b8015611d5e5780600019048511611d4f57611a8f611d48670de0b6b3a76400009287613a8b565b9150611a6e565b63035fc53d60e41b8252600482fd5b634e487b7160e01b82526012600452602482fd5b630700fcb360e11b8352600483fd5b63446c8cc960e01b8352600483fd5b639bfa3c1760e01b8152600490fd5b919250506020813d602011611dd0575b81611dbc602093836139c3565b810103126105fe57518591906119f66119eb565b3d9150611daf565b90506020813d602011611e02575b81611df3602093836139c3565b810103126105fe5751386119b0565b3d9150611de6565b6040513d84823e3d90fd5b631d7f2ac360e01b83526004869052602452604482fd5b633b5db2f360e11b8352600483fd5b50908152600c6020526040812054630d54e9e160e01b82526004849052602452604490fd5b632cd84af360e01b8252600482fd5b60405163313ce56760e01b815291939291602081600481865afa859181611eef575b50611ea55763105482c760e21b8552600485fd5b93919293838352600560205260ff806040852054169116908103611ec9575061192d565b90506044928252600560205260ff604083205416631e43476360e11b8352600452602452fd5b611f0991925060203d6020116109c9576109ba81836139c3565b9038611e91565b63a74c1c5f60e01b8152600490fd5b3381526009602052436040822055338152600a6020526001604082205561190b565b503461033b578060031936011261033b5760206040516103e88152f35b503461033b57604036600319011261033b576020906040906001600160a01b03611f8661392e565b16815260148352818120602435825283522054604051908152f35b503461033b57604036600319011261033b576040611fbd613944565b91600435815260008051602061478e833981519152602052209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b503461033b578060031936011261033b57602060405160648152f35b503461033b57604036600319011261033b5761205060209160043581526000805160206146ae8339815191528352604060243591206144b8565b905460405160039290921b1c6001600160a01b03168152f35b503461033b57602036600319011261033b576020906040906001600160a01b0361209161392e565b168152600983522054604051908152f35b503461033b57604036600319011261033b576120bc61392e565b60105460243591906001600160a01b0316330361215a576001600160a01b031690811561214b57604060008051602061476e8339815191529183855260136020528185205490848652601360205280838720558486526015602052828620438752602052828620548587526019602052838720558486526017602052438387205582519182526020820152a280f35b63df407ac560e01b8352600483fd5b6349db3bd360e01b8352600483fd5b503461033b57602036600319011261033b576020906040906001600160a01b0361219161392e565b168152600383522054604051908152f35b503461033b578060031936011261033b5760008051602061470e833981519152815260008051602061478e83398151915260209081526040808320336000908152925290205460ff1615612278576121f8613f4e565b600160ff196000805160206147ae8339815191525416176000805160206147ae833981519152557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a16040514281527f80170b5fcdd2bf1e0660ef4b8851f86685f64d41b1a19de1471947ece8725aac60203392a280f35b63e2517d3f60e01b81523360045260008051602061470e833981519152602452604490fd5b503461033b57602036600319011261033b576122b761392e565b60008051602061480e8339815191525460ff8160401c169081156123a3575b506123945760008051602061480e83398151915280546001600160481b0319166003600160401b0117905581805260008051602061478e83398151915260209081526040808420336000908152925290205460ff161561237c5761233990613c5e565b60ff60401b1960008051602061480e833981519152541660008051602061480e833981519152556000805160206146ee833981519152602060405160038152a180f35b63e2517d3f60e01b8252336004526024829052604482fd5b63f92ee8a960e01b8252600482fd5b60036001600160401b039190911610159050386122d6565b503461033b578060031936011261033b57602060ff6000805160206147ae83398151915254166040519015158152f35b503461033b57602036600319011261033b5761240561392e565b6010546001600160a01b031633036104795761043690613c5e565b503461033b57606036600319011261033b5761243a61392e565b612442613944565b60105490926044359290916001600160a01b0316330361047957612464613f4e565b6011546001600160a01b03169182156126de5760405163babcc53960e01b81526001600160a01b0386166004820181905293602090829060249082905afa908115611e0a57829161269f575b5015612690578215612681576001546001600160a01b03928316921682036125d1576040516370a0823160e01b8152306004820152602081602481865afa908115611e0a57829161259f575b50935b841561259057600019810361258a5750835b841561257b5780851161256357505061252d836020958361404c565b7f0bf519e4b3821615dbdd874fa1a5fbb4bb651b4e6beabedd4ac318e770233b2c604080518581524287820152a3604051908152f35b630555ed4f60e31b8252600485905260245260449150fd5b632e11316f60e11b8252600482fd5b93612511565b63f09872eb60e01b8252600482fd5b90506020813d6020116125c9575b816125ba602093836139c3565b810103126105fe5751386124fc565b3d91506125ad565b8181526002602052604081205460ff161561266f576040516370a0823160e01b8152306004820152602081602481865afa908115611e0a57829161263d575b5082825260076020526040822054808211156126355761262f91613b6c565b936124ff565b50508061262f565b90506020813d602011612667575b81612658602093836139c3565b810103126105fe575138612610565b3d915061264b565b60249163eef7849760e01b8252600452fd5b634e46966960e11b8152600490fd5b63133307bb60e21b8152600490fd5b90506020813d6020116126d6575b816126ba602093836139c3565b810103126126d2575180151581036126d257386124b0565b5080fd5b3d91506126ad565b630e048e7160e41b8152600490fd5b503461033b57602036600319011261033b5761270761392e565b6010546001600160a01b03163303610479576001600160a01b0316801561276c57601180546001600160a01b0319811683179091556001600160a01b03167f1e9c406f2707909cfd9f61e744f73bcab77e5997d063276f67883c5257d51cf08380a380f35b634e46966960e11b8252600482fd5b503461033b578060031936011261033b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031630036127d457602060405160008051602061472e8339815191528152f35b63703e46dd60e11b8152600490fd5b503461033b578060031936011261033b576010546040516001600160a01b039091168152602090f35b50604036600319011261033b5761282161392e565b602435906001600160401b038211611ca05736602383011215611ca0578160040135908361284e836139fc565b9361285c60405195866139c3565b83855260208501933660248284010111611ca057806024602093018637850101526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016308114908115612ade575b50612acf576010546001600160a01b03163303612ac0576001600160a01b038116928315612ab157813b15612aa25760008051602061472e83398151915254846128fa613a68565b7f6ea8b34d59b2818d3f37a08dddaa06f5886b9c20c907b36f03ca6528e106e86f61293060405192604084526040840190613a17565b4260208401526001600160a01b038516929081900390a36040516352d1902d60e01b8152602081600481895afa879181612a6a575b5061297e57634c9c8ce360e01b87526004869052602487fd5b908160008051602061472e83398151915288979303612a585750833b15612a44576001600160a01b031916811760008051602061472e833981519152558491907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8380a2805115612a295761113e9382915190845af43d15612a21573d91612a05836139fc565b92612a1360405194856139c3565b83523d85602085013e61460c565b60609161460c565b5050505034612a355780f35b63b398979f60e01b8152600490fd5b634c9c8ce360e01b86526004829052602486fd5b632a87526960e21b8752600452602486fd5b9091506020813d602011612a9a575b81612a86602093836139c3565b81010312612a9657519038612965565b8780fd5b3d9150612a79565b636f7c43f160e01b8552600485fd5b63e6c4247b60e01b8552600485fd5b6349db3bd360e01b8452600484fd5b63703e46dd60e11b8452600484fd5b60008051602061472e833981519152546001600160a01b031614159050386128b2565b503461033b57602036600319011261033b576020906040906001600160a01b03612b2961392e565b168152600e83522054604051908152f35b503461033b57606036600319011261033b57612b5461395a565b6024356001600160401b038111611ca057612b73903690600401613993565b916044356001600160401b038111610a5057612b93903690600401613993565b60008051602061480e8339815191529291925460ff8160401c16908115612ef6575b50612ee75760008051602061480e83398151915280546001600160481b0319166002600160401b011790556000805160206147ee833981519152865260008051602061478e83398151915260209081526040808820336000908152925290205460ff1615612ec257612c2561448a565b612c2d61448a565b60016000805160206147ce83398151915255600b549160ff8316612eb357818603612ea457612c5b86613bf9565b92612c6960405194856139c3565b868452601f19612c7888613bf9565b01366020860137875b878110612daf575060019060ff191617600b5515159460ff196008541660ff871617600855865b818110612d0c578760008051602061466e833981519152602089604051908152a160ff60401b1960008051602061480e833981519152541660008051602061480e833981519152556000805160206146ee833981519152602060405160028152a180f35b808860008051602061482e8339815191526040612d34612d2f600196888d613c10565b613c36565b612d3f85898c613c10565b357f8f955fa878b4aae8b1ac37b1ab715307470f2822ceff87e23d33ef1e044814a783612d6c888d613c4a565b5193898060a01b0316968793848252600660205280838320558482526007602052858383205582519182526020820152a28151908d82526020820152a201612ca8565b612dbd612d2f828a8a613c10565b612dc8828689613c10565b6001600160a01b03909116808b52600260205260408b20549091359060ff1615612e90576103e88111612e785750906020602492604051938480926370a0823160e01b82523060048301525afa8015612e6d578a90612e37575b60019250612e308288613c4a565b5201612c81565b509060203d8111612e66575b612e4d81836139c3565b6020826000928101031261033b57509060019151612e22565b503d612e43565b6040513d8c823e3d90fd5b631051834f60e11b8b526004526103e860245260448afd5b6351104c5960e01b8b52600482905260248bfd5b63512509d360e11b8752600487fd5b6324d0d1fd60e01b8752600487fd5b63e2517d3f60e01b8652336004526000805160206147ee833981519152602452604486fd5b63f92ee8a960e01b8652600486fd5b60026001600160401b03919091161015905038612bb5565b503461033b578060031936011261033b576011546040516001600160a01b039091168152602090f35b503461033b578060031936011261033b576010546001600160a01b03163303612fef576000805160206147ae8339815191525460ff811615612fe05760ff19166000805160206147ae833981519152557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a16040514281527f107553d8191d85b405879cf752997865edd48d94e20bda4dd27223c94b31a7cc60203392a280f35b638dfc202b60e01b8252600482fd5b6349db3bd360e01b8152600490fd5b503461033b57602036600319011261033b576020906040906001600160a01b0361302661392e565b168152601683522054604051908152f35b503461033b57604036600319011261033b57613051613944565b336001600160a01b0382160361306d5761113e9060043561411a565b63334bd91960e11b8252600482fd5b503461033b57602036600319011261033b576020906040906001600160a01b036130a461392e565b168152600c83522054604051908152f35b503461033b57602036600319011261033b576020906040906001600160a01b036130dd61392e565b168152601783522054604051908152f35b503461033b57604036600319011261033b5761113e60043561310e613944565b9061311b61113482613b79565b6140d2565b503461033b5761312f36613969565b91909261313a613f12565b613142613f4e565b3381526009602052604081205443036135be57338152600a602052600360408220541015611f1057338152600a602052604081206131808154613b9a565b90555b6001600160a01b0382168082526002602052604082205490929060ff16613543575b828252600260205260ff604083205416156104665760ff6008541615613534578415610457578315611e6057828252600d602052604082205480861061351d5750828252600f6020526040822054801561350e578086116134f857508461320b91613f78565b670de0b6b3a76400008402848104670de0b6b3a7640000036134e4578282526003602052604082205461323d91613ab4565b90828152600560205260ff604082205416601281106134c4575b50828152600660205261327c612710613274604084205485613a8b565b048093613b6c565b938085106134ac575082815260076020528360408220541061348857828152600760205260408120548481106134795760008051602061482e8339815191526040826132c9888895613b6c565b8486526007602052808387205582519182526020820152a26001546040516318160ddd60e01b815290602090829060049082906001600160a01b03165afa908115611e0a578291613447575b5081546001600160a01b0316803b15611ca057826040518092633a52b90760e11b82528183816133498d3360048401613bc2565b03925af18015611cef57613432575b506001546040516318160ddd60e01b81529190602090839060049082906001600160a01b03165afa908115611cef5783916133fc575b6133989250613b6c565b8581036133e45750507f8caf04742286d017f9ac3924388e188c73e6e5094311c5e59a61a7ef86dda8bf611bcd6020956133d386338761404c565b604051918291339588429285613bdd565b635ab6e2db60e01b8252600486905260245260449150fd5b90506020823d60201161342a575b81613417602093836139c3565b810103126105fe5761339891519061338e565b3d915061340a565b9161344081600493946139c3565b9190613358565b90506020813d602011613471575b81613462602093836139c3565b810103126126d2575138613315565b3d9150613455565b6308aed4ef60e31b8252600482fd5b82815260076020526040812054635960d22160e01b82526004526024849052604490fd5b6371c4efed60e01b8252600485905260245260449150fd5b916134d760ff6117526134dd9495613ad4565b90613ab4565b9038613257565b634e487b7160e01b82526011600452602482fd5b625502a360e91b83526004869052602452604482fd5b636c6ff70d60e11b8352600483fd5b6361767b8560e01b83526004869052602452604482fd5b630df65d9f60e01b8252600482fd5b60405163313ce56760e01b815291939291602081600481865afa85918161359d575b506135795763105482c760e21b8552600485fd5b93919293838352600560205260ff806040852054169116908103611ec957506131a5565b6135b791925060203d6020116109c9576109ba81836139c3565b9038613565565b3381526009602052436040822055338152600a60205260016040822055613183565b503461033b57602036600319011261033b576020610f3c600435613b79565b503461033b57602036600319011261033b576020906040906001600160a01b0361362761392e565b168152600f83522054604051908152f35b503461033b57604036600319011261033b5761365261392e565b60105460243591906001600160a01b0316330361215a576001600160a01b031690811561214b5760406000805160206146ce8339815191529183855260126020528185205490848652601260205280838720558486526014602052828620438752602052828620548587526018602052838720558486526016602052438387205582519182526020820152a280f35b503461033b57602036600319011261033b576020906040906001600160a01b0361370961392e565b168152600683522054604051908152f35b503461033b578060031936011261033b576001546040516001600160a01b039091168152602090f35b503461033b57602036600319011261033b576020906040906001600160a01b0361376b61392e565b168152600d83522054604051908152f35b503461033b57602036600319011261033b5761379661395a565b6010546001600160a01b0316330361047957602060008051602061466e83398151915291151560ff196008541660ff821617600855604051908152a180f35b503461033b57602036600319011261033b5760043563ffffffff60e01b81168091036126d257602090635a05180f60e01b811490811561381b575b506040519015158152f35b637965db0b60e01b811491508115613835575b5082613810565b6301ffc9a760e01b1490508261382e565b503461033b57604036600319011261033b5761386061392e565b6001600160a01b0316808252600260205260408220546024359060ff161561177457670de0b6b3a7640000810290808204670de0b6b3a7640000149015171561391a57916138bc60409383835260036020528483205490613ab4565b91808252600560205260ff8483205416601281106138f1575b5061172a84836127109361173295526006602052205484613a8b565b846117329361390f61271094966134d760ff61175261172a97613ad4565b9593509350506138d5565b634e487b7160e01b83526011600452602483fd5b600435906001600160a01b03821682036105fe57565b602435906001600160a01b03821682036105fe57565b6004359081151582036105fe57565b60609060031901126105fe576004356001600160a01b03811681036105fe57906024359060443590565b9181601f840112156105fe578235916001600160401b0383116105fe576020808501948460051b0101116105fe57565b601f909101601f19168101906001600160401b038211908210176139e657604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b0381116139e657601f01601f191660200190565b919082519283825260005b848110613a43575050826000602080949584010152601f8019910116010190565b80602080928401015182828601015201613a22565b6084359060ff821682036105fe57565b60405190613a776040836139c3565b6005825264322e332e3360d81b6020830152565b81810292918115918404141715613a9e57565b634e487b7160e01b600052601160045260246000fd5b8115613abe570490565b634e487b7160e01b600052601260045260246000fd5b60ff166012039060ff8211613a9e57565b8015613b665760009060208110600116604e821060011617613b5e57600a916001915b60018111613b35575082600019048211613b2157500290565b634e487b7160e01b81526011600452602490fd5b92806000190481116134e45760018416613b55575b80029260011c613b08565b80920291613b4a565b9050600a0a90565b50600190565b91908203918211613a9e57565b60005260008051602061478e83398151915260205260016040600020015490565b6000198114613a9e5760010190565b908160209103126105fe575160ff811681036105fe5790565b6001600160a01b039091168152602081019190915260400190565b9094939260609260808301968352602083015260408201520152565b6001600160401b0381116139e65760051b60200190565b9190811015613c205760051b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036105fe5790565b8051821015613c205760209160051b010190565b6001600160a01b03168015613c9f57601080546001600160a01b0319811683179091556001600160a01b031660008051602061474e833981519152600080a3565b63e6c4247b60e01b60005260046000fd5b91908201809211613a9e57565b94919360e0969360ff929a99989561010088019b885260208801526040870152166060850152608084015260a083015260c08201520152565b6001600160a01b03811660008181526002602052604090205490919060ff16158015613de8575b8015613de0575b613dce5781600052600f6020526040600020548015908115613dd6575b50613dce57613d66926040918251948592839262f7fce960e01b845260048401613bc2565b0381305afa918215613dc257600092613d8e575b506000526007602052604060002054101590565b9091506040813d604011613dba575b81613daa604093836139c3565b810103126105fe57519038613d7a565b3d9150613d9d565b6040513d6000823e3d90fd5b505050600090565b9050831138613d41565b508215613d24565b5060ff6008541615613d1d565b6001546001600160a01b0391821691168103613e6a576020602491604051928380926370a0823160e01b82523060048301525afa908115613dc257600091613e3b575090565b90506020813d602011613e62575b81613e56602093836139c3565b810103126105fe575190565b3d9150613e49565b80600052600260205260ff60406000205416613e865750600090565b6040516370a0823160e01b815230600482015290602082602481845afa918215613dc257600092613ede575b506000526007602052604060002054808211600014613ed757613ed491613b6c565b90565b5050600090565b90916020823d602011613f0a575b81613ef9602093836139c3565b8101031261033b5750519038613eb2565b3d9150613eec565b60026000805160206147ce8339815191525414613f3d5760026000805160206147ce83398151915255565b633ee5aeb560e01b60005260046000fd5b60ff6000805160206147ae8339815191525416613f6757565b63d93c066560e01b60005260046000fd5b6001600160a01b0316600081815260136020526040902054801561404757816000526015602052604060002043600052602052613fbb6040600020549384613cb0565b92831061403657808260005260176020524360406000205414614018575b8311613ffc57506000526015602052604060002043600052602052604060002055565b925063029359d560e41b60005260045260245260445260646000fd5b5081600052601960205261403160406000205482613cb0565b613fd9565b63446c8cc960e01b60005260046000fd5b505050565b614081614086939261407360405194859263a9059cbb60e01b602085015260248401613bc2565b03601f1981018452836139c3565b6142ed565b565b600081815260008051602061478e8339815191526020908152604080832033845290915290205460ff16156140ba5750565b63e2517d3f60e01b6000523360045260245260446000fd5b6140dc8282614348565b91826140e757505090565b60009182526000805160206146ae8339815191526020526040909120614116916001600160a01b0316906144d0565b5090565b61412482826143ea565b918261412f57505090565b60009182526000805160206146ae8339815191526020526040909120614116916001600160a01b031690614539565b6001600160a01b03166000818152601260205260409020548015614047578160005260146020526040600020436000526020526141a16040600020549384613cb0565b928310614036578082600052601660205243604060002054146141fe575b83116141e257506000526014602052604060002043600052602052604060002055565b92506319a4e2a760e01b60005260045260245260445260646000fd5b5081600052601860205261421760406000205482613cb0565b6141bf565b6040516323b872dd60e01b60208201526001600160a01b039283166024820152929091166044830152606480830193909352918152614086916140816084836139c3565b60405163313ce56760e01b81529190602090839060049082906001600160a01b03165afa600092816142cc575b506142a357631eecbb6560e01b60005260046000fd5b60ff91821691168082036142b5575050565b631e43476360e11b60005260045260245260446000fd5b6142e691935060203d6020116109c9576109ba81836139c3565b913861428d565b906000602091828151910182855af115613dc2576000513d61433f57506001600160a01b0381163b155b61431e5750565b635274afe760e01b60009081526001600160a01b0391909116600452602490fd5b60011415614317565b600081815260008051602061478e833981519152602090815260408083206001600160a01b038616845290915290205460ff16613ed757600081815260008051602061478e833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19166001179055339291907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b600081815260008051602061478e833981519152602090815260408083206001600160a01b038616845290915290205460ff1615613ed757600081815260008051602061478e833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19169055339291907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b60ff60008051602061480e8339815191525460401c16156144a757565b631afcd79f60e31b60005260046000fd5b8054821015613c205760005260206000200190600090565b6001810190826000528160205260406000205415600014613dce578054600160401b8110156139e65761452461450d8260018794018555846144b8565b819391549060031b91821b91600019901b19161790565b90555491600052602052604060002055600190565b9060018201918160005282602052604060002054801515600014614603576000198101818111613a9e578254600019810191908211613a9e578181036145cc575b505050805480156145b657600019019061459482826144b8565b8154906000199060031b1b191690555560005260205260006040812055600190565b634e487b7160e01b600052603160045260246000fd5b6145ec6145dc61450d93866144b8565b90549060031b1c928392866144b8565b90556000528360205260406000205538808061457a565b50505050600090565b90614632575080511561462157602081519101fd5b63d6bda27560e01b60005260046000fd5b81511580614664575b614643575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b1561463b56fe2c0a5f5ab0ba371221bb3612c2d2f90d36566279309f526000c5b354efd1b0658c67aaac7f77de07240e5a9b36dfdccb2a89c438635abbb27a73142d2aa0f629c1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e8237170593200048b07fab687f450848f1df8a96db08fef7840f53415f18fdc2ec8e9f810f0930c7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d275027301df982f5215b4963a854cf9c73219df80cb6acd8f098189c9480c7bbc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc17dc5b1290f7495d7f8cc68476e6941aaf510598fa925d0d2720edc8805a846c4460507c21097c15f6883572ebd157a9ee4b1d989a312314e93afd9d2ecd494002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a006d129bd71f2401cbe77f49f546d7d5f58992faecfca6e51ba06b50b261e83331a164736f6c6343000822000a";
|
|
17543
17894
|
var isSuperArgs = (xs) => xs.length > 1;
|
|
17544
|
-
var SimplePSMV2__factory = class extends
|
|
17895
|
+
var SimplePSMV2__factory = class extends import_ethers16.ContractFactory {
|
|
17545
17896
|
constructor(...args) {
|
|
17546
17897
|
if (isSuperArgs(args)) {
|
|
17547
17898
|
super(...args);
|
|
@@ -17561,15 +17912,15 @@ var SimplePSMV2__factory = class extends import_ethers15.ContractFactory {
|
|
|
17561
17912
|
static bytecode = _bytecode;
|
|
17562
17913
|
static abi = _abi;
|
|
17563
17914
|
static createInterface() {
|
|
17564
|
-
return new
|
|
17915
|
+
return new import_ethers16.Interface(_abi);
|
|
17565
17916
|
}
|
|
17566
17917
|
static connect(address, runner) {
|
|
17567
|
-
return new
|
|
17918
|
+
return new import_ethers16.Contract(address, _abi, runner);
|
|
17568
17919
|
}
|
|
17569
17920
|
};
|
|
17570
17921
|
|
|
17571
17922
|
// src/contracts/typechain-contracts/factories/src/agent/AgentDelegationRegistry__factory.ts
|
|
17572
|
-
var
|
|
17923
|
+
var import_ethers17 = require("ethers");
|
|
17573
17924
|
var _abi2 = [
|
|
17574
17925
|
{
|
|
17575
17926
|
inputs: [],
|
|
@@ -17679,6 +18030,11 @@ var _abi2 = [
|
|
|
17679
18030
|
name: "InvalidAddress",
|
|
17680
18031
|
type: "error"
|
|
17681
18032
|
},
|
|
18033
|
+
{
|
|
18034
|
+
inputs: [],
|
|
18035
|
+
name: "InvalidAgentConsent",
|
|
18036
|
+
type: "error"
|
|
18037
|
+
},
|
|
17682
18038
|
{
|
|
17683
18039
|
inputs: [],
|
|
17684
18040
|
name: "InvalidFloor",
|
|
@@ -18132,6 +18488,12 @@ var _abi2 = [
|
|
|
18132
18488
|
name: "ContractUpgraded",
|
|
18133
18489
|
type: "event"
|
|
18134
18490
|
},
|
|
18491
|
+
{
|
|
18492
|
+
anonymous: false,
|
|
18493
|
+
inputs: [],
|
|
18494
|
+
name: "EIP712DomainChanged",
|
|
18495
|
+
type: "event"
|
|
18496
|
+
},
|
|
18135
18497
|
{
|
|
18136
18498
|
anonymous: false,
|
|
18137
18499
|
inputs: [
|
|
@@ -18303,6 +18665,19 @@ var _abi2 = [
|
|
|
18303
18665
|
name: "Upgraded",
|
|
18304
18666
|
type: "event"
|
|
18305
18667
|
},
|
|
18668
|
+
{
|
|
18669
|
+
inputs: [],
|
|
18670
|
+
name: "AGENT_BINDING_CONSENT_TYPEHASH",
|
|
18671
|
+
outputs: [
|
|
18672
|
+
{
|
|
18673
|
+
internalType: "bytes32",
|
|
18674
|
+
name: "",
|
|
18675
|
+
type: "bytes32"
|
|
18676
|
+
}
|
|
18677
|
+
],
|
|
18678
|
+
stateMutability: "view",
|
|
18679
|
+
type: "function"
|
|
18680
|
+
},
|
|
18306
18681
|
{
|
|
18307
18682
|
inputs: [],
|
|
18308
18683
|
name: "DEFAULT_ADMIN_ROLE",
|
|
@@ -18433,6 +18808,30 @@ var _abi2 = [
|
|
|
18433
18808
|
stateMutability: "view",
|
|
18434
18809
|
type: "function"
|
|
18435
18810
|
},
|
|
18811
|
+
{
|
|
18812
|
+
inputs: [
|
|
18813
|
+
{
|
|
18814
|
+
internalType: "address",
|
|
18815
|
+
name: "user",
|
|
18816
|
+
type: "address"
|
|
18817
|
+
},
|
|
18818
|
+
{
|
|
18819
|
+
internalType: "address",
|
|
18820
|
+
name: "agent",
|
|
18821
|
+
type: "address"
|
|
18822
|
+
}
|
|
18823
|
+
],
|
|
18824
|
+
name: "agentBindingConsentDigest",
|
|
18825
|
+
outputs: [
|
|
18826
|
+
{
|
|
18827
|
+
internalType: "bytes32",
|
|
18828
|
+
name: "",
|
|
18829
|
+
type: "bytes32"
|
|
18830
|
+
}
|
|
18831
|
+
],
|
|
18832
|
+
stateMutability: "view",
|
|
18833
|
+
type: "function"
|
|
18834
|
+
},
|
|
18436
18835
|
{
|
|
18437
18836
|
inputs: [],
|
|
18438
18837
|
name: "agentMintFloorMinBps",
|
|
@@ -18683,6 +19082,49 @@ var _abi2 = [
|
|
|
18683
19082
|
stateMutability: "nonpayable",
|
|
18684
19083
|
type: "function"
|
|
18685
19084
|
},
|
|
19085
|
+
{
|
|
19086
|
+
inputs: [],
|
|
19087
|
+
name: "eip712Domain",
|
|
19088
|
+
outputs: [
|
|
19089
|
+
{
|
|
19090
|
+
internalType: "bytes1",
|
|
19091
|
+
name: "fields",
|
|
19092
|
+
type: "bytes1"
|
|
19093
|
+
},
|
|
19094
|
+
{
|
|
19095
|
+
internalType: "string",
|
|
19096
|
+
name: "name",
|
|
19097
|
+
type: "string"
|
|
19098
|
+
},
|
|
19099
|
+
{
|
|
19100
|
+
internalType: "string",
|
|
19101
|
+
name: "version",
|
|
19102
|
+
type: "string"
|
|
19103
|
+
},
|
|
19104
|
+
{
|
|
19105
|
+
internalType: "uint256",
|
|
19106
|
+
name: "chainId",
|
|
19107
|
+
type: "uint256"
|
|
19108
|
+
},
|
|
19109
|
+
{
|
|
19110
|
+
internalType: "address",
|
|
19111
|
+
name: "verifyingContract",
|
|
19112
|
+
type: "address"
|
|
19113
|
+
},
|
|
19114
|
+
{
|
|
19115
|
+
internalType: "bytes32",
|
|
19116
|
+
name: "salt",
|
|
19117
|
+
type: "bytes32"
|
|
19118
|
+
},
|
|
19119
|
+
{
|
|
19120
|
+
internalType: "uint256[]",
|
|
19121
|
+
name: "extensions",
|
|
19122
|
+
type: "uint256[]"
|
|
19123
|
+
}
|
|
19124
|
+
],
|
|
19125
|
+
stateMutability: "view",
|
|
19126
|
+
type: "function"
|
|
19127
|
+
},
|
|
18686
19128
|
{
|
|
18687
19129
|
inputs: [
|
|
18688
19130
|
{
|
|
@@ -19055,6 +19497,11 @@ var _abi2 = [
|
|
|
19055
19497
|
internalType: "uint64",
|
|
19056
19498
|
name: "validUntil",
|
|
19057
19499
|
type: "uint64"
|
|
19500
|
+
},
|
|
19501
|
+
{
|
|
19502
|
+
internalType: "bytes",
|
|
19503
|
+
name: "agentConsent",
|
|
19504
|
+
type: "bytes"
|
|
19058
19505
|
}
|
|
19059
19506
|
],
|
|
19060
19507
|
name: "registerAgent",
|
|
@@ -19132,6 +19579,11 @@ var _abi2 = [
|
|
|
19132
19579
|
internalType: "uint64",
|
|
19133
19580
|
name: "validUntil",
|
|
19134
19581
|
type: "uint64"
|
|
19582
|
+
},
|
|
19583
|
+
{
|
|
19584
|
+
internalType: "bytes",
|
|
19585
|
+
name: "agentConsent",
|
|
19586
|
+
type: "bytes"
|
|
19135
19587
|
}
|
|
19136
19588
|
],
|
|
19137
19589
|
name: "rotateAgent",
|
|
@@ -19260,9 +19712,9 @@ var _abi2 = [
|
|
|
19260
19712
|
type: "function"
|
|
19261
19713
|
}
|
|
19262
19714
|
];
|
|
19263
|
-
var _bytecode2 = "0x60a080604052346100ea57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c166100d9576002600160401b03196001600160401b03821601610073575b60405161304c90816100f0823960805181818161114401526113290152f35b6001600160401b0319166001600160401b039081177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880610054565b63f92ee8a960e01b60005260046000fd5b600080fdfe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611ff7575080630d33f3c214611fd35780630f3f4a9414611f885780631459457a14611be257806318c38b8914611ad15780631d44454114611a005780632106764c146119d9578063248a9ca3146119b35780632ec22d4c146118f25780632f0647ce146118775780632f2ff15d14611846578063324207441461177257806336568abe1461172c578063392f1087146116f65780633f4ba83a146115fe5780633f5aadc91461158f5780634f1ef286146112ad57806352340363146111c45780635273b6f61461119b57806352d1902d14611131578063554c4f4b146110a1578063561b7f8a14610f755780635bc26aea14610ee85780635c975abb14610eb85780636289d18c14610e375780636711cc0b14610e1b5780636e852a7814610d1a5780637e35bf6e14610ce65780638343f67414610cb95780638456cb5914610bc35780638f33527f14610b895780639010d07c14610b3557806391d1485414610adb5780639b9d30c114610ab2578063a19af3f614610a01578063a217fddf146109e5578063a3246ad314610923578063a878086414610907578063ac3c0e30146107fa578063ad3cb1cc146107b3578063b3fad6381461070e578063c34e9c26146106f2578063c86deb31146106d6578063ca15c8731461069d578063d547741f14610665578063dd71d99a14610623578063e0922fa114610576578063efa9b4ae14610507578063f2f4eb26146104de578063f68e9553146104b5578063f94f67ab146103de578063fd437d391461029f5763ffa1ad741461026657600080fd5b3461029a57600036600319011261029a576102966102826121ed565b6040519182916020835260208301906121c8565b0390f35b600080fd5b3461029a57606036600319011261029a576102b861207a565b6102c0612064565b906102c961218f565b906102d2612795565b6001600160a01b0316338190036103ce5780600052600160205260406000209283549360ff8560e01c1660038110156103b8576001036103a75781600160209261033e877fc5d5c5bbf10444998e0ea6d4725e79027b574e1c14ec929279e8a9a95c6c6e919688612c43565b818060a01b038316828060a01b031982541617815561035d878261239f565b0180546001600160401b031916426001600160401b03908116919091179091556001600160a01b0391821660008181526002855260409081902087905551969091168652951693a4005b632437e77160e11b60005260046000fd5b634e487b7160e01b600052602160045260246000fd5b62fca64560e31b60005260046000fd5b3461029a57604036600319011261029a576004356103fa6120c9565b90610403612795565b63ffffffff600554169163ffffffff8116928084109081156104ac575b5061049b5760207f6b7727cc9c3df4a29acf0afe01594c1b7e845d20f40f4a14e4c292164a9ed8e191610452846127e0565b9161046a600863ffffffff845460a01c1617836122e3565b81546001600160e01b031660e09190911b6001600160e01b0319161790556040519485526001600160a01b031693a3005b634346c13160e01b60005260046000fd5b90501584610420565b3461029a57600036600319011261029a576020604051600080516020612fe08339815191528152f35b3461029a57600036600319011261029a576003546040516001600160a01b039091168152602090f35b3461029a57602036600319011261029a57600435610523612795565b61054561052f826127e0565b9190600163ffffffff825460a01c1617906122e3565b6001600160a01b0316907f812690e0a9dff5bf3add998111b8af5c8299608d859025bfe35662060ab4267d600080a3005b3461029a57602036600319011261029a576004356001600160401b0381169081810361029a576000546001600160a01b038116330361061257600160a01b600160e01b0319811660a092831b600160a01b600160e01b031617600055604080519190921c6001600160401b0316815260208101929092527f9c195448332abd01f716db873b329752ea02f19d33f7e311fb0daf082c4edd0391a1005b6349db3bd360e01b60005260046000fd5b3461029a57602036600319011261029a576001600160a01b0361064461207a565b166000526002602052602060018060a01b0360406000205416604051908152f35b3461029a57604036600319011261029a5761069b600435610684612064565b90610696610691826122c2565b6126bf565b612751565b005b3461029a57602036600319011261029a57600435600052600080516020612ee08339815191526020526020604060002054604051908152f35b3461029a57600036600319011261029a57602060405160088152f35b3461029a57600036600319011261029a57602060405160028152f35b3461029a57602036600319011261029a576000606060405161072f81612136565b828152826020820152826040820152015260043560005260046020526080604060002063ffffffff6040519161076483612136565b548160018060a01b038216938481528160208201818560a01c16815260606040840193838760c01c168552019460e01c8552604051968752511660208601525116604084015251166060820152f35b3461029a57600036600319011261029a5761029660408051906107d68183612151565b60058252640352e302e360dc1b6020830152519182916020835260208301906121c8565b3461029a57602036600319011261029a5761081361207a565b6000608060405161082381612105565b828152826020820152826040820152826060820152015260018060a01b03166000526001602052604060002060405161085b81612105565b81546001600160a01b038116825260a081901c6001600160401b03166020830190815292604083019160e01c60ff169060038210156103b857908252600101546001600160401b0380821660608501908152604092831c821660808601908152925194516001600160a01b03168552945116602084015290519260038410156103b857604083019390935291516001600160401b0390811660608301529151909116608082015260a090f35b3461029a57600036600319011261029a57602060405160018152f35b3461029a57602036600319011261029a57600435600052600080516020612ee083398151915260205260406000206040518060208354918281520190819360005260206000209060005b8181106109cf5750505081610983910382612151565b6040519182916020830190602084525180915260408301919060005b8181106109ad575050500390f35b82516001600160a01b031684528594506020938401939092019160010161099f565b825484526020909301926001928301920161096d565b3461029a57600036600319011261029a57602060405160008152f35b3461029a57604036600319011261029a57600435610a1d6120c9565b90610a26612795565b63ffffffff600554169163ffffffff811692808410908115610aa9575b5061049b5760207f1da95b87b4c773f68c1447ffc5644e41a8a8887d55065beb64852014cf7140be91610a96610a78856127e0565b9290610a91600463ffffffff835460a01c1617826122e3565b612210565b6040519485526001600160a01b031693a3005b90501584610a43565b3461029a57600036600319011261029a576020604051600080516020612f208339815191528152f35b3461029a57604036600319011261029a57610af4612064565b600435600052600080516020612fc083398151915260205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b3461029a57604036600319011261029a57600435600052600080516020612ee08339815191526020526020610b706024356040600020612d0c565b905460405160039290921b1c6001600160a01b03168152f35b3461029a57602036600319011261029a576001600160a01b03610baa61207a565b1660005260026020526020604060002054604051908152f35b3461029a57600036600319011261029a573360009081527f0ac8cc3d209806126662940717264973110c39045b305f6ba49613325a615e09602052604090205460ff1615610c9257610c13612795565b600160ff19600080516020613000833981519152541617600080516020613000833981519152557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a16040514281527f80170b5fcdd2bf1e0660ef4b8851f86685f64d41b1a19de1471947ece8725aac60203392a2005b63e2517d3f60e01b60005233600452600080516020612f2083398151915260245260446000fd5b3461029a57600036600319011261029a5760005460405160a09190911c6001600160401b03168152602090f35b3461029a57604036600319011261029a57610d0a610d02612064565b60043561236c565b906102966040519283928361209a565b3461029a57604036600319011261029a57610d3361207a565b336000908152600080516020612f60833981519152602052604090205460ff161580610e08575b6103ce576001600160a01b03166000818152600160205260409020805460e01c60ff1660038110156103b8576001036103a757805460ff60e01b198116600160e11b1782556001919091018054600160401b600160801b03191642604090811b600160401b600160801b0316919091179091555160243581526001600160a01b0390911691907fc0499cc07ed9d734deec6857802d3f0fa8d5afaf79a7008beb8ba7bef62a271b90602090a3005b50336001600160a01b0382161415610d5a565b3461029a57600036600319011261029a57602060405160048152f35b3461029a57602036600319011261029a57610e506120b6565b6000546001600160a01b031633036106125763ffffffff8116908115610ea757600080516020612fa083398151915291610ea263ffffffff926005549284198416176005556040519384931683612233565b0390a1005b6338f3377360e21b60005260046000fd5b3461029a57600036600319011261029a57602060ff60008051602061300083398151915254166040519015158152f35b3461029a57602036600319011261029a57610f0161207a565b6000546001600160a01b0381169033829003610612576001600160a01b038316928315610f64573b15610f53576001600160a01b03191682176000908155600080516020612f808339815191529080a3005b636f7c43f160e01b60005260046000fd5b63e6c4247b60e01b60005260046000fd5b3461029a57606036600319011261029a57610f8e61207a565b610f96612064565b610f9e61218f565b91610fa7612795565b6001600160a01b031690338290036103ce57816000526001602052604060002060ff815460e01c1660038110156103b857600114611090578160209161100f867ff223dc085722c94c84dcf67427e225799be616382a2a484d378f8921c69a20339587612c43565b80546001600160a01b0319166001600160a01b038316178155611032868261239f565b6001810180546001600160801b031916426001600160401b0390811691909117909155815460ff60e01b1916600160e01b179091556001600160a01b03919091166000818152600284526040908190208690555195909116855293a3005b639d2c8fdf60e01b60005260046000fd5b3461029a57602036600319011261029a576001600160a01b036110c261207a565b166000526001602052604060002060ff60008051602061300083398151915254161580611115575b602091816110fe575b506040519015158152f35b5460a01c6001600160401b031642109050826110f3565b5060ff815460e01c169060038210156103b857906001146110ea565b3461029a57600036600319011261029a577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361118a576020604051600080516020612f408339815191528152f35b63703e46dd60e11b60005260046000fd5b3461029a57600036600319011261029a576000546040516001600160a01b039091168152602090f35b3461029a57602036600319011261029a57600435604060008281526004602052209081549160018060a01b03831692831590811561129e575b5061128d57336000908152600080516020612f60833981519152602052604090205460ff161580611283575b611272578061124563fffffffe61124b935460a01c16826122e3565b8261269b565b7fa5ffbdba01b15df97334e34ad816b9986b6057a5ddc97aba93b7e8ccd21759ed600080a3005b630a606ec360e11b60005260046000fd5b5082331415611229565b6360eb6c2360e01b60005260046000fd5b6001915060a01c1615846111fd565b604036600319011261029a576112c161207a565b602435906001600160401b03821161029a573660238301121561029a578160040135906112ed82612174565b916112fb6040519384612151565b8083526020830193366024838301011161029a57816000926024602093018737840101526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630811490811561156c575b5061118a576000546001600160a01b03163303610612576001600160a01b038116928315610f6457813b1561155b5730841461154c57600080516020612f4083398151915254846113a36121ed565b7f6ea8b34d59b2818d3f37a08dddaa06f5886b9c20c907b36f03ca6528e106e86f6113d9604051926040845260408401906121c8565b4260208401526001600160a01b038516929081900390a36040516352d1902d60e01b8152602081600481895afa60009181611518575b506114295785634c9c8ce360e01b60005260045260246000fd5b9081600080516020612f408339815191528793036115045750833b156114ef576001600160a01b0319168117600080516020612f40833981519152557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28251156114d4576000809161069b945190845af43d156114cc573d916114af83612174565b926114bd6040519485612151565b83523d6000602085013e612e7e565b606091612e7e565b505050346114de57005b63b398979f60e01b60005260046000fd5b50634c9c8ce360e01b60005260045260246000fd5b632a87526960e21b60005260045260246000fd5b9091506020813d602011611544575b8161153460209383612151565b8101031261029a5751908761140f565b3d9150611527565b614e8d60eb1b60005260046000fd5b632e07c4bd60e11b60005260046000fd5b600080516020612f40833981519152546001600160a01b03161415905084611354565b3461029a57602036600319011261029a576004356115ab612795565b6115cd6115b7826127e0565b9190600263ffffffff825460a01c1617906122e3565b6001600160a01b0316907fc2713e691344add4705edc62a0ee5aede95ba66ad68f97316efef9cb50644edd600080a3005b3461029a57600036600319011261029a57336000908152600080516020612f60833981519152602052604090205460ff1615806116e1575b6116d0576000805160206130008339815191525460ff8116156116bf5760ff1916600080516020613000833981519152557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a16040514281527f107553d8191d85b405879cf752997865edd48d94e20bda4dd27223c94b31a7cc60203392a2005b638dfc202b60e01b60005260046000fd5b63659a07b360e11b60005260046000fd5b506000546001600160a01b0316331415611636565b3461029a57604036600319011261029a5761029661171d611715612064565b600435612306565b604093919351938493846120dc565b3461029a57604036600319011261029a57611745612064565b336001600160a01b038216036117615761069b90600435612751565b63334bd91960e11b60005260046000fd5b3461029a57602036600319011261029a57600435604060008281526004602052209081549160018060a01b038316928315908115611837575b5061128d57336000908152600080516020612f60833981519152602052604090205460ff16158061182d575b61127257806117f363fffffff7611806935460a01c16826122e3565b80546001600160e01b031681558261269b565b7f054490ec6650e07db9b97a06ea31d44cebd44b390c9975a380055e1b4d3cac21600080a3005b50823314156117d7565b6008915060a01c1615846117ab565b3461029a57604036600319011261029a5761069b600435611865612064565b90611872610691826122c2565b612709565b3461029a57602036600319011261029a576004356118c161189782612629565b91906118ad63fffffffb825460a01c16826122e3565b805463ffffffff60c01b191681558361269b565b6001600160a01b0316907f09cb4ec44cdef8489412844b9682f87f7900758fa2bd7e039113e9125e538e0f600080a3005b3461029a57602036600319011261029a57600435604060008281526004602052209081549160018060a01b0383169283159081156119a4575b5061128d57336000908152600080516020612f60833981519152602052604090205460ff16158061199a575b611272578061124563fffffffd611973935460a01c16826122e3565b7fb390ab029eab314bd18190ebe73d7e5c1c336beaa5c83ac22578378dc9ccc405600080a3005b5082331415611957565b6002915060a01c16158461192b565b3461029a57602036600319011261029a5760206119d16004356122c2565b604051908152f35b3461029a57604036600319011261029a5761029661171d6119f8612064565b60043561224a565b3461029a57604036600319011261029a57600435611a1c6120c9565b63ffffffff600554169063ffffffff811691808310908115611ac8575b5061049b57611a4783612629565b909263ffffffff845460c01c16809260018060a01b03163314159182611abd575b5050611aac57611a98827e8a218591d4362499c38c38eb1c12e7a7cc97a9068818d1fe6046a42ba4a5ba94612210565b611aa760405192839283612233565b0390a2005b634e80a40760e11b60005260046000fd5b111590508186611a68565b90501584611a39565b3461029a57602036600319011261029a57611aea6120b6565b6000805160206130208339815191525460ff8160401c16908115611bca575b50611bb957600080516020613020833981519152805460026001600160401b0319821681179092556000546001600160481b031990911690911791906001600160a01b031633036106125763ffffffff168015610ea757604081600080516020612fa08339815191529263ffffffff196005541617600555815190600082526020820152a160008051602061302083398151915255600080516020612f00833981519152602060405160028152a1005b63f92ee8a960e01b60005260046000fd5b60026001600160401b03919091161015905082611b09565b3461029a5760a036600319011261029a57611bfb61207a565b611c03612064565b906044356001600160a01b03811680820361029a576064356001600160a01b0381169182820361029a576084356001600160a01b038116949085900361029a5760008051602061302083398151915254604081901c60ff161596906001600160401b031680159081611f80575b6001149081611f76575b159081611f6d575b50611bb95760008051602061302083398151915280546001600160401b031916600117905586611f48575b611cb5612acc565b611cbd612acc565b611cc5612acc565b611ccd612acc565b6001600160a01b038116908115610f64578315610f64578515610f64576001600160a01b038916988915610f64573b15610f5357858414611f375762aa36a746148015611f2c575b8015611f21575b1580611f0f575b610f5357611d32906000612afa565b9081611ec8575b5015611e0d57611d5790600080516020612fe0833981519152612afa565b9081611e73575b5015611e0d57611d7c90600080516020612f20833981519152612afa565b9081611e1e575b5015611e0d57600080546001600160a01b031916841781556040519390600080516020612f808339815191528180a38015610f6457803b15610f5357600380546001600160a01b031916919091179055611dd957005b600080516020613020833981519152805460ff60401b1916905560018152600080516020612f0083398151915290602090a1005b63cf5a8e3360e01b60005260046000fd5b600080516020612f20833981519152600052600080516020612ee0833981519152602052611e6c907ffff5b43478fa6840382eb63777e0da6941d320b940e3f70f0ea4780feff95827612d3a565b5084611d83565b600080516020612fe0833981519152600052600080516020612ee0833981519152602052611ec1907f32d31393d541a265984ec379cddd8b1fcbe5f2b0eb8ad81dddfead454f135eaa612d3a565b5086611d5e565b60008052600080516020612ee0833981519152602052611f08907f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd44612d3a565b5088611d39565b50823b1580611d235750843b15611d23565b50617a694614611d1c565b506105394614611d15565b638135316560e01b60005260046000fd5b600080516020613020833981519152805460ff60401b1916600160401b179055611cad565b90501589611c82565b303b159150611c7a565b889150611c70565b3461029a57604036600319011261029a57610296611fbc611fa7612064565b600435600052600460205260406000206123c8565b611fc581612090565b60405191818392158361209a565b3461029a57600036600319011261029a57602063ffffffff60055416604051908152f35b3461029a57602036600319011261029a576004359063ffffffff60e01b821680920361029a57602091635a05180f60e01b8114908115612039575b5015158152f35b637965db0b60e01b811491508115612053575b5083612032565b6301ffc9a760e01b1490508361204c565b602435906001600160a01b038216820361029a57565b600435906001600160a01b038216820361029a57565b600811156103b857565b9015158152604081019291906020906120b283612090565b0152565b6004359063ffffffff8216820361029a57565b6024359063ffffffff8216820361029a57565b91604091949363ffffffff916060850196151585526120fa81612090565b602085015216910152565b60a081019081106001600160401b0382111761212057604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761212057604052565b601f909101601f19168101906001600160401b0382119082101761212057604052565b6001600160401b03811161212057601f01601f191660200190565b604435906001600160401b038216820361029a57565b60005b8381106121b85750506000910152565b81810151838201526020016121a8565b906020916121e1815180928185528580860191016121a5565b601f01601f1916010190565b604051906121fc604083612151565b60058252640322e312e360dc1b6020830152565b805463ffffffff60c01b191660c09290921b63ffffffff60c01b16919091179055565b63ffffffff91821681529116602082015260400190565b600052600460205261226160406000209182612485565b61226a81612090565b806122b857505460e01c63ffffffff60055416811580156122b0575b6122a35780821061229c57505b60019160009190565b9050612293565b5050600090600390600090565b508015612286565b6000929091508290565b600052600080516020612fc083398151915260205260016040600020015490565b805463ffffffff60a01b191660a09290921b63ffffffff60a01b16919091179055565b919091600052600460205261232060406000209283612511565b9161232a83612090565b826123625763ffffffff9192505460c01c1663ffffffff60055416811580156122b0576122a35780821061229c575060019160009190565b5060009190600090565b90612383916000526004602052604060002061259d565b61238c81612090565b8061239a5750600190600090565b600091565b8054600160a01b600160e01b03191660a09290921b600160a01b600160e01b0316919091179055565b60ff600080516020613000833981519152541661247e57546001600160a01b0381169081156124765760a01c6002161561246f5760005260016020526040600020549060ff8260e01c1660038110156103b857801561246757600214612460574260a083901c6001600160401b03161115612459576001600160a01b0390811691160361245457600090565b600790565b5050600690565b5050600590565b505050600490565b5050600390565b505050600290565b5050600190565b60ff600080516020613000833981519152541661247e57546001600160a01b0381169081156124765760a01c6008161561246f5760005260016020526040600020549060ff8260e01c1660038110156103b857801561246757600214612460574260a083901c6001600160401b03161115612459576001600160a01b0390811691160361245457600090565b60ff600080516020613000833981519152541661247e57546001600160a01b0381169081156124765760a01c6004161561246f5760005260016020526040600020549060ff8260e01c1660038110156103b857801561246757600214612460574260a083901c6001600160401b03161115612459576001600160a01b0390811691160361245457600090565b60ff600080516020613000833981519152541661247e57546001600160a01b0381169081156124765760a01c6001161561246f5760005260016020526040600020549060ff8260e01c1660038110156103b857801561246757600214612460574260a083901c6001600160401b03161115612459576001600160a01b0390811691160361245457600090565b6000908152600460205260409020805490916001600160a01b03821691821590811561268c575b5061128d57336000908152600080516020612f60833981519152602052604090205460ff161580612682575b61127257565b508133141561267c565b6004915060a01c161538612650565b905460a01c63ffffffff16156126ae5750565b600052600460205260006040812055565b6000818152600080516020612fc08339815191526020908152604080832033845290915290205460ff16156126f15750565b63e2517d3f60e01b6000523360045260245260446000fd5b6127138282612afa565b918261271e57505090565b6000918252600080516020612ee0833981519152602052604090912061274d916001600160a01b031690612d3a565b5090565b61275b8282612ba3565b918261276657505090565b6000918252600080516020612ee0833981519152602052604090912061274d916001600160a01b031690612dab565b60ff60008051602061300083398151915254166127ae57565b63d93c066560e01b60005260046000fd5b519064ffffffffff8216820361029a57565b519061ffff8216820361029a57565b8015612abb57600354604051638d34875560e01b8152600481018390529190600090839060249082906001600160a01b03165afa918215612aaf57600092612904575b5060808201516001600160a01b0316913383900361127257610120015161284981612090565b61285281612090565b600381149081156128ef575b81156128db575b506128ca5781600052600160205260ff60406000205460e01c1660038110156103b8576001036128b957600090815260046020526040902080546001600160a01b0319166001600160a01b03831617815591565b632e68d1d360e21b60005260046000fd5b63e9f6db8560e01b60005260046000fd5b600791506128e881612090565b1438612865565b90506128fa81612090565b600581149061285e565b90913d8082843e6129158184612151565b820191602081840312612a8f578051906001600160401b038211612a975701906101a082840312612a8c57604051926101a084016001600160401b03811185821017612a9b5760409081528351855260208085015190860152838101519085015260608301516001600160401b038111612a9757830181601f82011215612a97578051906129a282612174565b926129b06040519485612151565b82845260208383010111612a9357906129cf91602080850191016121a5565b606084015260808201516001600160a01b0381168103612a8f5760808401526129fa60a083016127bf565b60a0840152612a0b60c083016127bf565b60c0840152612a1c60e083016127d1565b60e0840152612a2e61010083016127bf565b610100840152610120820151906008821015612a8c5750612a7f9161018091610120850152612a6061014082016127bf565b610140850152612a7361016082016127d1565b610160850152016127bf565b6101808201529038612823565b80fd5b5080fd5b8380fd5b8280fd5b634e487b7160e01b83526041600452602483fd5b6040513d6000823e3d90fd5b637bb0b62160e01b60005260046000fd5b60ff6000805160206130208339815191525460401c1615612ae957565b631afcd79f60e31b60005260046000fd5b6000818152600080516020612fc0833981519152602090815260408083206001600160a01b038616845290915290205460ff16612b9c576000818152600080516020612fc0833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19166001179055339291907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b5050600090565b6000818152600080516020612fc0833981519152602090815260408083206001600160a01b038616845290915290205460ff1615612b9c576000818152600080516020612fc0833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19169055339291907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b158015612cfb575b610f64576001600160a01b0316600090815260026020526040902054612cea576001600160401b031642811115612cd95760005460a01c6001600160401b03168015159182612cae575b5050612c9d57565b63e774e7b560e01b60005260046000fd5b909150428103908111612cc357113880612c95565b634e487b7160e01b600052601160045260246000fd5b63efa7aefd60e01b60005260046000fd5b633b53f64f60e21b60005260046000fd5b506001600160a01b03811615612c4b565b8054821015612d245760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b6001810190826000528160205260406000205415600014612da3578054600160401b81101561212057612d8e612d77826001879401855584612d0c565b819391549060031b91821b91600019901b19161790565b90555491600052602052604060002055600190565b505050600090565b9060018201918160005282602052604060002054801515600014612e75576000198101818111612cc3578254600019810191908211612cc357818103612e3e575b50505080548015612e28576000190190612e068282612d0c565b8154906000199060031b1b191690555560005260205260006040812055600190565b634e487b7160e01b600052603160045260246000fd5b612e5e612e4e612d779386612d0c565b90549060031b1c92839286612d0c565b905560005283602052604060002055388080612dec565b50505050600090565b90612ea45750805115612e9357602081519101fd5b63d6bda27560e01b60005260046000fd5b81511580612ed6575b612eb5575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15612ead56fec1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000c7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d275027301df982f5215b4963a854cf9c73219df80cb6acd8f098189c9480c7bbc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc07966f2ab141347034724e9b2a472c2f77f5cd745aeba27cacba797b8fcb708617dc5b1290f7495d7f8cc68476e6941aaf510598fa925d0d2720edc8805a846cd37bc77615afefc793aa17d75d4249a9b517ba91b0e54a49c9c4a44b3d7e228302dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800edcc084d3dcd65a1f7f23c65c46722faca6953d28e43150a467cf43e5c309238cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a164736f6c6343000822000a";
|
|
19715
|
+
var _bytecode2 = "0x60a080604052346100ea57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c166100d9576002600160401b03196001600160401b03821601610073575b60405161394690816100f082396080518181816112d4015261148b0152f35b6001600160401b0319166001600160401b039081177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880610054565b63f92ee8a960e01b60005260046000fd5b600080fdfe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a7146124f5575080630d33f3c2146124d15780630f3f4a94146124865780631459457a14611d3e57806318c38b8914611c2d5780631d44454114611b5c5780632106764c14611b35578063248a9ca314611b175780632ec22d4c14611a565780632f0647ce146119db5780632f2ff15d146119aa57806332420744146118d657806336568abe14611890578063392f10871461185a5780633f4ba83a146117625780633f5aadc9146116f35780634f1ef2861461143d57806352340363146113545780635273b6f61461132b57806352d1902d146112c1578063554c4f4b146112315780635bc26aea146111a45780635c975abb146111745780636289d18c146110f35780636711cc0b146110d75780636e852a7814610fd65780637e35bf6e14610fa25780638343f67414610f755780638456cb5914610e7f57806384b0196e14610d545780638c02cabd14610d2b5780638f33527f14610cf15780639010d07c14610c9d57806391d1485414610c435780639b9d30c114610c1a578063a19af3f614610b69578063a217fddf14610b4d578063a3246ad314610a8b578063a878086414610a6f578063ac3c0e3014610962578063ad3cb1cc1461091b578063b3fad63814610876578063b48d36de14610842578063c040b8ae14610726578063c34e9c261461070a578063c86deb31146106ee578063ca15c873146106b5578063d547741f1461067d578063dd71d99a1461063b578063e0922fa11461058e578063efa9b4ae1461051f578063f2f4eb26146104f6578063f68e9553146104cd578063f94f67ab146103f6578063fcc1f21a146102c05763ffa1ad741461028757600080fd5b346102bb5760003660031901126102bb576102b76102a3612780565b6040519182916020835260208301906126d1565b0390f35b600080fd5b346102bb576102ce366126f6565b91926102d8612e42565b6001600160a01b03851692338490036103e657836000526001602052604060002080549160ff8360e01c1660038110156103d0576001036103bf577fc5d5c5bbf10444998e0ea6d4725e79027b574e1c14ec929279e8a9a95c6c6e91948460016103a2946103498b6020998c613385565b818060a01b038316828060a01b03198254161781556103688b82612a4c565b0180546001600160401b031916426001600160401b03161790556001600160a01b0381166000818152600288526040902089905599613179565b6040516001600160401b0390951685526001600160a01b031693a4005b632437e77160e11b60005260046000fd5b634e487b7160e01b600052602160045260246000fd5b62fca64560e31b60005260046000fd5b346102bb5760403660031901126102bb576004356104126125c7565b9061041b612e42565b63ffffffff600554169163ffffffff8116928084109081156104c4575b506104b35760207f6b7727cc9c3df4a29acf0afe01594c1b7e845d20f40f4a14e4c292164a9ed8e19161046a84612e8d565b91610482600863ffffffff845460a01c1617836128c8565b81546001600160e01b031660e09190911b6001600160e01b0319161790556040519485526001600160a01b031693a3005b634346c13160e01b60005260046000fd5b90501584610438565b346102bb5760003660031901126102bb5760206040516000805160206138ba8339815191528152f35b346102bb5760003660031901126102bb576003546040516001600160a01b039091168152602090f35b346102bb5760203660031901126102bb5760043561053b612e42565b61055d61054782612e8d565b9190600163ffffffff825460a01c1617906128c8565b6001600160a01b0316907f812690e0a9dff5bf3add998111b8af5c8299608d859025bfe35662060ab4267d600080a3005b346102bb5760203660031901126102bb576004356001600160401b038116908181036102bb576000546001600160a01b038116330361062a57600160a01b600160e01b0319811660a092831b600160a01b600160e01b031617600055604080519190921c6001600160401b0316815260208101929092527f9c195448332abd01f716db873b329752ea02f19d33f7e311fb0daf082c4edd0391a1005b6349db3bd360e01b60005260046000fd5b346102bb5760203660031901126102bb576001600160a01b0361065c612578565b166000526002602052602060018060a01b0360406000205416604051908152f35b346102bb5760403660031901126102bb576106b360043561069c612562565b906106ae6106a9826128a7565b612d6c565b612dfe565b005b346102bb5760203660031901126102bb5760043560005260008051602061373a8339815191526020526020604060002054604051908152f35b346102bb5760003660031901126102bb57602060405160088152f35b346102bb5760003660031901126102bb57602060405160028152f35b346102bb57610734366126f6565b92909161073f612e42565b6001600160a01b03851693338590036103e65784600052600160205260406000209060ff825460e01c1660038110156103d057600114610831577ff223dc085722c94c84dcf67427e225799be616382a2a484d378f8921c69a2033948461081e936107ad866020988b613385565b80546001600160a01b0319166001600160a01b0383161781556107d08682612a4c565b6001810180546001600160801b031916426001600160401b0316179055805460ff60e01b1916600160e01b1790556001600160a01b0381166000818152600288526040902089905598613179565b6040516001600160401b039091168152a3005b639d2c8fdf60e01b60005260046000fd5b346102bb5760403660031901126102bb57602061086e610860612578565b610868612562565b90612984565b604051908152f35b346102bb5760203660031901126102bb57600060606040516108978161261e565b828152826020820152826040820152015260043560005260046020526080604060002063ffffffff604051916108cc8361261e565b548160018060a01b038216938481528160208201818560a01c16815260606040840193838760c01c168552019460e01c8552604051968752511660208601525116604084015251166060820152f35b346102bb5760003660031901126102bb576102b7604080519061093e8183612639565b60058252640352e302e360dc1b6020830152519182916020835260208301906126d1565b346102bb5760203660031901126102bb5761097b612578565b6000608060405161098b81612603565b828152826020820152826040820152826060820152015260018060a01b0316600052600160205260406000206040516109c381612603565b81546001600160a01b038116825260a081901c6001600160401b03166020830190815292604083019160e01c60ff169060038210156103d057908252600101546001600160401b0380821660608501908152604092831c821660808601908152925194516001600160a01b03168552945116602084015290519260038410156103d057604083019390935291516001600160401b0390811660608301529151909116608082015260a090f35b346102bb5760003660031901126102bb57602060405160018152f35b346102bb5760203660031901126102bb5760043560005260008051602061373a83398151915260205260406000206040518060208354918281520190819360005260206000209060005b818110610b375750505081610aeb910382612639565b6040519182916020830190602084525180915260408301919060005b818110610b15575050500390f35b82516001600160a01b0316845285945060209384019390920191600101610b07565b8254845260209093019260019283019201610ad5565b346102bb5760003660031901126102bb57602060405160008152f35b346102bb5760403660031901126102bb57600435610b856125c7565b90610b8e612e42565b63ffffffff600554169163ffffffff811692808410908115610c11575b506104b35760207f1da95b87b4c773f68c1447ffc5644e41a8a8887d55065beb64852014cf7140be91610bfe610be085612e8d565b9290610bf9600463ffffffff835460a01c1617826128c8565b6127f5565b6040519485526001600160a01b031693a3005b90501584610bab565b346102bb5760003660031901126102bb5760206040516000805160206137fa8339815191528152f35b346102bb5760403660031901126102bb57610c5c612562565b60043560005260008051602061389a83398151915260205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b346102bb5760403660031901126102bb5760043560005260008051602061373a8339815191526020526020610cd86024356040600020613357565b905460405160039290921b1c6001600160a01b03168152f35b346102bb5760203660031901126102bb576001600160a01b03610d12612578565b1660005260026020526020604060002054604051908152f35b346102bb5760003660031901126102bb5760206040516000805160206137da8339815191528152f35b346102bb5760003660031901126102bb576000805160206137ba833981519152541580610e68575b15610e2b57610dcd610d8c6127a3565b610d946127d6565b6020610ddb60405192610da78385612639565b600084526000368137604051958695600f60f81b875260e08588015260e08701906126d1565b9085820360408701526126d1565b466060850152306080850152600060a085015283810360c085015281808451928381520193019160005b828110610e1457505050500390f35b835185528695509381019392810192600101610e05565b60405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b6044820152606490fd5b5060008051602061391a8339815191525415610d7c565b346102bb5760003660031901126102bb573360009081527f0ac8cc3d209806126662940717264973110c39045b305f6ba49613325a615e09602052604090205460ff1615610f4e57610ecf612e42565b600160ff196000805160206138da8339815191525416176000805160206138da833981519152557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a16040514281527f80170b5fcdd2bf1e0660ef4b8851f86685f64d41b1a19de1471947ece8725aac60203392a2005b63e2517d3f60e01b600052336004526000805160206137fa83398151915260245260446000fd5b346102bb5760003660031901126102bb5760005460405160a09190911c6001600160401b03168152602090f35b346102bb5760403660031901126102bb57610fc6610fbe612562565b600435612951565b906102b760405192839283612598565b346102bb5760403660031901126102bb57610fef612578565b33600090815260008051602061383a833981519152602052604090205460ff1615806110c4575b6103e6576001600160a01b03166000818152600160205260409020805460e01c60ff1660038110156103d0576001036103bf57805460ff60e01b198116600160e11b1782556001919091018054600160401b600160801b03191642604090811b600160401b600160801b0316919091179091555160243581526001600160a01b0390911691907fc0499cc07ed9d734deec6857802d3f0fa8d5afaf79a7008beb8ba7bef62a271b90602090a3005b50336001600160a01b0382161415611016565b346102bb5760003660031901126102bb57602060405160048152f35b346102bb5760203660031901126102bb5761110c6125b4565b6000546001600160a01b0316330361062a5763ffffffff81169081156111635760008051602061387a8339815191529161115e63ffffffff926005549284198416176005556040519384931683612818565b0390a1005b6338f3377360e21b60005260046000fd5b346102bb5760003660031901126102bb57602060ff6000805160206138da83398151915254166040519015158152f35b346102bb5760203660031901126102bb576111bd612578565b6000546001600160a01b038116903382900361062a576001600160a01b038316928315611220573b1561120f576001600160a01b0319168217600090815560008051602061385a8339815191529080a3005b636f7c43f160e01b60005260046000fd5b63e6c4247b60e01b60005260046000fd5b346102bb5760203660031901126102bb576001600160a01b03611252612578565b166000526001602052604060002060ff6000805160206138da833981519152541615806112a5575b6020918161128e575b506040519015158152f35b5460a01c6001600160401b03164210905082611283565b5060ff815460e01c169060038210156103d0579060011461127a565b346102bb5760003660031901126102bb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361131a57602060405160008051602061381a8339815191528152f35b63703e46dd60e11b60005260046000fd5b346102bb5760003660031901126102bb576000546040516001600160a01b039091168152602090f35b346102bb5760203660031901126102bb57600435604060008281526004602052209081549160018060a01b03831692831590811561142e575b5061141d5733600090815260008051602061383a833981519152602052604090205460ff161580611413575b61140257806113d563fffffffe6113db935460a01c16826128c8565b82612d48565b7fa5ffbdba01b15df97334e34ad816b9986b6057a5ddc97aba93b7e8ccd21759ed600080a3005b630a606ec360e11b60005260046000fd5b50823314156113b9565b6360eb6c2360e01b60005260046000fd5b6001915060a01c16158461138d565b60403660031901126102bb57611451612578565b6024356001600160401b0381116102bb57366023820112156102bb57611481903690602481600401359101612677565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163081149081156116d0575b5061131a576000546001600160a01b0316330361062a576001600160a01b03821691821561122057803b156116bf573083146116b05760008051602061381a8339815191525483611505612780565b7f6ea8b34d59b2818d3f37a08dddaa06f5886b9c20c907b36f03ca6528e106e86f61153b604051926040845260408401906126d1565b4260208401526001600160a01b038516929081900390a36040516352d1902d60e01b8152602081600481885afa6000918161167c575b5061158b5784634c9c8ce360e01b60005260045260246000fd5b908160008051602061381a8339815191528693036116685750823b15611653576001600160a01b031916811760008051602061381a833981519152557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2815115611639576000808360206106b395519101845af43d15611631573d916116148361265c565b926116226040519485612639565b83523d6000602085013e61364d565b60609161364d565b50503461164257005b63b398979f60e01b60005260046000fd5b50634c9c8ce360e01b60005260045260246000fd5b632a87526960e21b60005260045260246000fd5b9091506020813d6020116116a8575b8161169860209383612639565b810103126102bb57519086611571565b3d915061168b565b614e8d60eb1b60005260046000fd5b632e07c4bd60e11b60005260046000fd5b60008051602061381a833981519152546001600160a01b031614159050836114b6565b346102bb5760203660031901126102bb5760043561170f612e42565b61173161171b82612e8d565b9190600263ffffffff825460a01c1617906128c8565b6001600160a01b0316907fc2713e691344add4705edc62a0ee5aede95ba66ad68f97316efef9cb50644edd600080a3005b346102bb5760003660031901126102bb5733600090815260008051602061383a833981519152602052604090205460ff161580611845575b611834576000805160206138da8339815191525460ff8116156118235760ff19166000805160206138da833981519152557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a16040514281527f107553d8191d85b405879cf752997865edd48d94e20bda4dd27223c94b31a7cc60203392a2005b638dfc202b60e01b60005260046000fd5b63659a07b360e11b60005260046000fd5b506000546001600160a01b031633141561179a565b346102bb5760403660031901126102bb576102b7611881611879612562565b6004356128eb565b604093919351938493846125da565b346102bb5760403660031901126102bb576118a9612562565b336001600160a01b038216036118c5576106b390600435612dfe565b63334bd91960e11b60005260046000fd5b346102bb5760203660031901126102bb57600435604060008281526004602052209081549160018060a01b03831692831590811561199b575b5061141d5733600090815260008051602061383a833981519152602052604090205460ff161580611991575b611402578061195763fffffff761196a935460a01c16826128c8565b80546001600160e01b0316815582612d48565b7f054490ec6650e07db9b97a06ea31d44cebd44b390c9975a380055e1b4d3cac21600080a3005b508233141561193b565b6008915060a01c16158461190f565b346102bb5760403660031901126102bb576106b36004356119c9612562565b906119d66106a9826128a7565b612db6565b346102bb5760203660031901126102bb57600435611a256119fb82612cd6565b9190611a1163fffffffb825460a01c16826128c8565b805463ffffffff60c01b1916815583612d48565b6001600160a01b0316907f09cb4ec44cdef8489412844b9682f87f7900758fa2bd7e039113e9125e538e0f600080a3005b346102bb5760203660031901126102bb57600435604060008281526004602052209081549160018060a01b038316928315908115611b08575b5061141d5733600090815260008051602061383a833981519152602052604090205460ff161580611afe575b61140257806113d563fffffffd611ad7935460a01c16826128c8565b7fb390ab029eab314bd18190ebe73d7e5c1c336beaa5c83ac22578378dc9ccc405600080a3005b5082331415611abb565b6002915060a01c161584611a8f565b346102bb5760203660031901126102bb57602061086e6004356128a7565b346102bb5760403660031901126102bb576102b7611881611b54612562565b60043561282f565b346102bb5760403660031901126102bb57600435611b786125c7565b63ffffffff600554169063ffffffff811691808310908115611c24575b506104b357611ba383612cd6565b909263ffffffff845460c01c16809260018060a01b03163314159182611c19575b5050611c0857611bf4827e8a218591d4362499c38c38eb1c12e7a7cc97a9068818d1fe6046a42ba4a5ba946127f5565b611c0360405192839283612818565b0390a2005b634e80a40760e11b60005260046000fd5b111590508186611bc4565b90501584611b95565b346102bb5760203660031901126102bb57611c466125b4565b6000805160206138fa8339815191525460ff8160401c16908115611d26575b50611d15576000805160206138fa833981519152805460026001600160401b0319821681179092556000546001600160481b031990911690911791906001600160a01b0316330361062a5763ffffffff1680156111635760408160008051602061387a8339815191529263ffffffff196005541617600555815190600082526020820152a16000805160206138fa8339815191525560008051602061377a833981519152602060405160028152a1005b63f92ee8a960e01b60005260046000fd5b60026001600160401b03919091161015905082611c65565b346102bb5760a03660031901126102bb57611d57612578565b611d5f612562565b604435906001600160a01b0382168083036102bb576064356001600160a01b038116918282036102bb576084356001600160a01b03811695908690036102bb576000805160206138fa83398151915254604081901c60ff161597906001600160401b03168015908161247e575b6001149081612474575b15908161246b575b50611d15576000805160206138fa83398151915280546001600160401b031916600117905587612446575b611e116131e0565b611e196131e0565b611e216131e0565b611e296131e0565b6001600160a01b038116908115611220578315611220578515611220576001600160a01b038716968715611220573b1561120f578584146124355762aa36a74614801561242a575b801561241f575b158061240d575b61120f57611e8e90600061320e565b90816123c6575b501561230b57611eb3906000805160206138ba83398151915261320e565b9081612371575b501561230b57611ed8906000805160206137fa83398151915261320e565b908161231c575b501561230b57600080546001600160a01b0319168217815560008051602061385a8339815191528180a3611f116127a3565b91611f1a6127d6565b91611f236131e0565b611f2b6131e0565b83516001600160401b0381116121e05760008051602061375a83398151915254600181811c91168015612301575b60208210146121c057601f8111612282575b50602094601f8211600114612201579481929394956000926121f6575b50508160011b916000199060031b1c19161760008051602061375a833981519152555b82516001600160401b0381116121e05760008051602061379a83398151915254600181811c911680156121d6575b60208210146121c057601f8111612141575b506020601f82116001146120c057819293946000926120b5575b50508160011b916000199060031b1c19161760008051602061379a833981519152555b60006000805160206137ba83398151915255600060008051602061391a83398151915255801561122057803b1561120f57600380546001600160a01b03191691909117905561207357005b60ff60401b196000805160206138fa83398151915254166000805160206138fa8339815191525560008051602061377a833981519152602060405160018152a1005b015190508480612005565b601f1982169060008051602061379a833981519152600052806000209160005b81811061212957509583600195969710612110575b505050811b0160008051602061379a83398151915255612028565b015160001960f88460031b161c191690558480806120f5565b9192602060018192868b0151815501940192016120e0565b81811115611feb5760008051602061379a833981519152600052601f820160051c7f5f9ce34815f8e11431c7bb75a8e6886a91478f7ffc1dbb0a98dc240fddd76b75602084106121b7575b81601f9101920160051c039060005b8281106121a9575050611feb565b60008282015560010161219b565b6000915061218c565b634e487b7160e01b600052602260045260246000fd5b90607f1690611fd9565b634e487b7160e01b600052604160045260246000fd5b015190508580611f88565b601f1982169560008051602061375a833981519152600052806000209160005b88811061226a57508360019596979810612251575b505050811b0160008051602061375a83398151915255611fab565b015160001960f88460031b161c19169055858080612236565b91926020600181928685015181550194019201612221565b81811115611f6b5760008051602061375a833981519152600052601f820160051c7f42ad5d3e1f2e6e70edcf6d991b8a3023d3fca8047a131592f9edb9fd9b89d57d602084106122f8575b81601f9101920160051c039060005b8281106122ea575050611f6b565b6000828201556001016122dc565b600091506122cd565b90607f1690611f59565b63cf5a8e3360e01b60005260046000fd5b6000805160206137fa83398151915260005260008051602061373a83398151915260205261236a907ffff5b43478fa6840382eb63777e0da6941d320b940e3f70f0ea4780feff9582761348a565b5084611edf565b6000805160206138ba83398151915260005260008051602061373a8339815191526020526123bf907f32d31393d541a265984ec379cddd8b1fcbe5f2b0eb8ad81dddfead454f135eaa61348a565b5086611eba565b6000805260008051602061373a833981519152602052612406907f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd4461348a565b5088611e95565b50823b1580611e7f5750843b15611e7f565b50617a694614611e78565b506105394614611e71565b638135316560e01b60005260046000fd5b6000805160206138fa833981519152805460ff60401b1916600160401b179055611e09565b90501589611dde565b303b159150611dd6565b899150611dcc565b346102bb5760403660031901126102bb576102b76124ba6124a5612562565b60043560005260046020526040600020612a75565b6124c38161258e565b604051918183921583612598565b346102bb5760003660031901126102bb57602063ffffffff60055416604051908152f35b346102bb5760203660031901126102bb576004359063ffffffff60e01b82168092036102bb57602091635a05180f60e01b8114908115612537575b5015158152f35b637965db0b60e01b811491508115612551575b5083612530565b6301ffc9a760e01b1490508361254a565b602435906001600160a01b03821682036102bb57565b600435906001600160a01b03821682036102bb57565b600811156103d057565b9015158152604081019291906020906125b08361258e565b0152565b6004359063ffffffff821682036102bb57565b6024359063ffffffff821682036102bb57565b91604091949363ffffffff916060850196151585526125f88161258e565b602085015216910152565b60a081019081106001600160401b038211176121e057604052565b608081019081106001600160401b038211176121e057604052565b601f909101601f19168101906001600160401b038211908210176121e057604052565b6001600160401b0381116121e057601f01601f191660200190565b9291926126838261265c565b916126916040519384612639565b8294818452818301116102bb578281602093846000960137010152565b60005b8381106126c15750506000910152565b81810151838201526020016126b1565b906020916126ea815180928185528580860191016126ae565b601f01601f1916010190565b60806003198201126102bb576004356001600160a01b03811681036102bb57916024356001600160a01b03811681036102bb57916044356001600160401b03811681036102bb57916064356001600160401b0381116102bb57826023820112156102bb576004810135926001600160401b0384116102bb57602484830101116102bb576024019190565b6040519061278f604083612639565b60058252640332e302e360dc1b6020830152565b604051906127b2604083612639565b6015825274111a585b5bdb9912185b991ccb941c9bdd1bd8dbdb605a1b6020830152565b604051906127e5604083612639565b60018252603160f81b6020830152565b805463ffffffff60c01b191660c09290921b63ffffffff60c01b16919091179055565b63ffffffff91821681529116602082015260400190565b600052600460205261284660406000209182612b32565b61284f8161258e565b8061289d57505460e01c63ffffffff6005541681158015612895575b6128885780821061288157505b60019160009190565b9050612878565b5050600090600390600090565b50801561286b565b6000929091508290565b60005260008051602061389a83398151915260205260016040600020015490565b805463ffffffff60a01b191660a09290921b63ffffffff60a01b16919091179055565b919091600052600460205261290560406000209283612bbe565b9161290f8361258e565b826129475763ffffffff9192505460c01c1663ffffffff60055416811580156128955761288857808210612881575060019160009190565b5060009190600090565b906129689160005260046020526040600020612c4a565b6129718161258e565b8061297f5750600190600090565b600091565b6042916040519060208201926000805160206137da833981519152845260018060a01b0316604083015260018060a01b03166060820152606081526129ca608082612639565b5190206129d56136ae565b6129dd613706565b6040519060208201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a08152612a2e60c082612639565b519020906040519161190160f01b8352600283015260228201522090565b8054600160a01b600160e01b03191660a09290921b600160a01b600160e01b0316919091179055565b60ff6000805160206138da8339815191525416612b2b57546001600160a01b038116908115612b235760a01c60021615612b1c5760005260016020526040600020549060ff8260e01c1660038110156103d0578015612b1457600214612b0d574260a083901c6001600160401b03161115612b06576001600160a01b03908116911603612b0157600090565b600790565b5050600690565b5050600590565b505050600490565b5050600390565b505050600290565b5050600190565b60ff6000805160206138da8339815191525416612b2b57546001600160a01b038116908115612b235760a01c60081615612b1c5760005260016020526040600020549060ff8260e01c1660038110156103d0578015612b1457600214612b0d574260a083901c6001600160401b03161115612b06576001600160a01b03908116911603612b0157600090565b60ff6000805160206138da8339815191525416612b2b57546001600160a01b038116908115612b235760a01c60041615612b1c5760005260016020526040600020549060ff8260e01c1660038110156103d0578015612b1457600214612b0d574260a083901c6001600160401b03161115612b06576001600160a01b03908116911603612b0157600090565b60ff6000805160206138da8339815191525416612b2b57546001600160a01b038116908115612b235760a01c60011615612b1c5760005260016020526040600020549060ff8260e01c1660038110156103d0578015612b1457600214612b0d574260a083901c6001600160401b03161115612b06576001600160a01b03908116911603612b0157600090565b6000908152600460205260409020805490916001600160a01b038216918215908115612d39575b5061141d5733600090815260008051602061383a833981519152602052604090205460ff161580612d2f575b61140257565b5081331415612d29565b6004915060a01c161538612cfd565b905460a01c63ffffffff1615612d5b5750565b600052600460205260006040812055565b600081815260008051602061389a8339815191526020908152604080832033845290915290205460ff1615612d9e5750565b63e2517d3f60e01b6000523360045260245260446000fd5b612dc0828261320e565b9182612dcb57505090565b600091825260008051602061373a8339815191526020526040909120612dfa916001600160a01b03169061348a565b5090565b612e0882826132b7565b9182612e1357505090565b600091825260008051602061373a8339815191526020526040909120612dfa916001600160a01b0316906134fb565b60ff6000805160206138da8339815191525416612e5b57565b63d93c066560e01b60005260046000fd5b519064ffffffffff821682036102bb57565b519061ffff821682036102bb57565b801561316857600354604051638d34875560e01b8152600481018390529190600090839060249082906001600160a01b03165afa91821561315c57600092612fb1575b5060808201516001600160a01b03169133839003611402576101200151612ef68161258e565b612eff8161258e565b60038114908115612f9c575b8115612f88575b50612f775781600052600160205260ff60406000205460e01c1660038110156103d057600103612f6657600090815260046020526040902080546001600160a01b0319166001600160a01b03831617815591565b632e68d1d360e21b60005260046000fd5b63e9f6db8560e01b60005260046000fd5b60079150612f958161258e565b1438612f12565b9050612fa78161258e565b6005811490612f0b565b90913d8082843e612fc28184612639565b82019160208184031261313c578051906001600160401b0382116131445701906101a08284031261313957604051926101a084016001600160401b038111858210176131485760409081528351855260208085015190860152838101519085015260608301516001600160401b03811161314457830181601f820112156131445780519061304f8261265c565b9261305d6040519485612639565b82845260208383010111613140579061307c91602080850191016126ae565b606084015260808201516001600160a01b038116810361313c5760808401526130a760a08301612e6c565b60a08401526130b860c08301612e6c565b60c08401526130c960e08301612e7e565b60e08401526130db6101008301612e6c565b610100840152610120820151906008821015613139575061312c916101809161012085015261310d6101408201612e6c565b6101408501526131206101608201612e7e565b61016085015201612e6c565b6101808201529038612ed0565b80fd5b5080fd5b8380fd5b8280fd5b634e487b7160e01b83526041600452602483fd5b6040513d6000823e3d90fd5b637bb0b62160e01b60005260046000fd5b61319b9261318d8361319593969496612984565b923691612677565b9061344e565b5060048110156103d05715918215926131c8575b50506131b757565b63cacba36560e01b60005260046000fd5b6001600160a01b0391821691161415905038806131af565b60ff6000805160206138fa8339815191525460401c16156131fd57565b631afcd79f60e31b60005260046000fd5b600081815260008051602061389a833981519152602090815260408083206001600160a01b038616845290915290205460ff166132b057600081815260008051602061389a833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19166001179055339291907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b5050600090565b600081815260008051602061389a833981519152602090815260408083206001600160a01b038616845290915290205460ff16156132b057600081815260008051602061389a833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19169055339291907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b805482101561336f5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b15801561343d575b611220576001600160a01b031660009081526002602052604090205461342c576001600160401b03164281111561341b5760005460a01c6001600160401b031680151591826133f0575b50506133df57565b63e774e7b560e01b60005260046000fd5b909150428103908111613405571138806133d7565b634e487b7160e01b600052601160045260246000fd5b63efa7aefd60e01b60005260046000fd5b633b53f64f60e21b60005260046000fd5b506001600160a01b0381161561338d565b815191906041830361347f5761347892506020820151906060604084015193015160001a906135ce565b9192909190565b505060009160029190565b60018101908260005281602052604060002054156000146134f3578054600160401b8110156121e0576134de6134c7826001879401855584613357565b819391549060031b91821b91600019901b19161790565b90555491600052602052604060002055600190565b505050600090565b90600182019181600052826020526040600020548015156000146135c55760001981018181116134055782546000198101919082116134055781810361358e575b505050805480156135785760001901906135568282613357565b8154906000199060031b1b191690555560005260205260006040812055600190565b634e487b7160e01b600052603160045260246000fd5b6135ae61359e6134c79386613357565b90549060031b1c92839286613357565b90556000528360205260406000205538808061353c565b50505050600090565b91906fa2a8918ca85bafe22016d0b997e4df60600160ff1b038411613641579160209360809260ff60009560405194855216868401526040830152606082015282805260015afa1561315c576000516001600160a01b038116156136355790600090600090565b50600090600190600090565b50505060009160039190565b90613673575080511561366257602081519101fd5b63d6bda27560e01b60005260046000fd5b815115806136a5575b613684575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b1561367c565b6136b66127a3565b80519081156136c6576020012090565b50506000805160206137ba8339815191525480156136e15790565b507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47090565b61370e6127d6565b805190811561371e576020012090565b505060008051602061391a8339815191525480156136e1579056fec1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d102c7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d103a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d1002b26bde9d050a2447879fc2826d068ca8d51a693da5ddde56556964c09fea96875027301df982f5215b4963a854cf9c73219df80cb6acd8f098189c9480c7bbc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc07966f2ab141347034724e9b2a472c2f77f5cd745aeba27cacba797b8fcb708617dc5b1290f7495d7f8cc68476e6941aaf510598fa925d0d2720edc8805a846cd37bc77615afefc793aa17d75d4249a9b517ba91b0e54a49c9c4a44b3d7e228302dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800edcc084d3dcd65a1f7f23c65c46722faca6953d28e43150a467cf43e5c309238cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d101a164736f6c6343000822000a";
|
|
19264
19716
|
var isSuperArgs2 = (xs) => xs.length > 1;
|
|
19265
|
-
var AgentDelegationRegistry__factory = class extends
|
|
19717
|
+
var AgentDelegationRegistry__factory = class extends import_ethers17.ContractFactory {
|
|
19266
19718
|
constructor(...args) {
|
|
19267
19719
|
if (isSuperArgs2(args)) {
|
|
19268
19720
|
super(...args);
|
|
@@ -19282,10 +19734,10 @@ var AgentDelegationRegistry__factory = class extends import_ethers16.ContractFac
|
|
|
19282
19734
|
static bytecode = _bytecode2;
|
|
19283
19735
|
static abi = _abi2;
|
|
19284
19736
|
static createInterface() {
|
|
19285
|
-
return new
|
|
19737
|
+
return new import_ethers17.Interface(_abi2);
|
|
19286
19738
|
}
|
|
19287
19739
|
static connect(address, runner) {
|
|
19288
|
-
return new
|
|
19740
|
+
return new import_ethers17.Contract(
|
|
19289
19741
|
address,
|
|
19290
19742
|
_abi2,
|
|
19291
19743
|
runner
|
|
@@ -19294,7 +19746,7 @@ var AgentDelegationRegistry__factory = class extends import_ethers16.ContractFac
|
|
|
19294
19746
|
};
|
|
19295
19747
|
|
|
19296
19748
|
// src/utils/position-delegate.utils.ts
|
|
19297
|
-
var
|
|
19749
|
+
var import_ethers18 = require("ethers");
|
|
19298
19750
|
var POSITION_DELEGATE_REGISTRY_ABI = [
|
|
19299
19751
|
"function positionDelegate(bytes32 positionId) view returns (address)",
|
|
19300
19752
|
"function isDelegate(bytes32 positionId, address delegate) view returns (bool)",
|
|
@@ -19313,7 +19765,7 @@ var DELEGATE_STATUS_ABI = [
|
|
|
19313
19765
|
"function delegateStatus(bytes32 positionId, address delegate) view returns (bool ok, uint8 reason)"
|
|
19314
19766
|
];
|
|
19315
19767
|
async function setPositionDelegate(positionId, delegate, signer, registryAddress) {
|
|
19316
|
-
const registry = new
|
|
19768
|
+
const registry = new import_ethers18.Contract(
|
|
19317
19769
|
registryAddress,
|
|
19318
19770
|
POSITION_DELEGATE_REGISTRY_ABI,
|
|
19319
19771
|
signer
|
|
@@ -19321,7 +19773,7 @@ async function setPositionDelegate(positionId, delegate, signer, registryAddress
|
|
|
19321
19773
|
return registry["setPositionDelegate"](positionId, delegate);
|
|
19322
19774
|
}
|
|
19323
19775
|
async function getPositionDelegate(positionId, provider, registryAddress) {
|
|
19324
|
-
const registry = new
|
|
19776
|
+
const registry = new import_ethers18.Contract(
|
|
19325
19777
|
registryAddress,
|
|
19326
19778
|
POSITION_DELEGATE_REGISTRY_ABI,
|
|
19327
19779
|
provider
|
|
@@ -19329,7 +19781,7 @@ async function getPositionDelegate(positionId, provider, registryAddress) {
|
|
|
19329
19781
|
return registry["positionDelegate"](positionId);
|
|
19330
19782
|
}
|
|
19331
19783
|
async function isPositionDelegate(positionId, delegate, provider, registryAddress) {
|
|
19332
|
-
const registry = new
|
|
19784
|
+
const registry = new import_ethers18.Contract(
|
|
19333
19785
|
registryAddress,
|
|
19334
19786
|
POSITION_DELEGATE_REGISTRY_ABI,
|
|
19335
19787
|
provider
|
|
@@ -19337,7 +19789,7 @@ async function isPositionDelegate(positionId, delegate, provider, registryAddres
|
|
|
19337
19789
|
return registry["isDelegate"](positionId, delegate);
|
|
19338
19790
|
}
|
|
19339
19791
|
async function getDelegateStatus(positionId, delegate, provider, registryAddress) {
|
|
19340
|
-
const registry = new
|
|
19792
|
+
const registry = new import_ethers18.Contract(
|
|
19341
19793
|
registryAddress,
|
|
19342
19794
|
DELEGATE_STATUS_ABI,
|
|
19343
19795
|
provider
|
|
@@ -19352,6 +19804,12 @@ async function getDelegateStatus(positionId, delegate, provider, registryAddress
|
|
|
19352
19804
|
}
|
|
19353
19805
|
|
|
19354
19806
|
// src/utils/agent-delegation.utils.ts
|
|
19807
|
+
var AGENT_BINDING_CONSENT_TYPES = {
|
|
19808
|
+
AgentBindingConsent: [
|
|
19809
|
+
{ name: "user", type: "address" },
|
|
19810
|
+
{ name: "agent", type: "address" }
|
|
19811
|
+
]
|
|
19812
|
+
};
|
|
19355
19813
|
async function mintAgentPkp(params) {
|
|
19356
19814
|
const { serviceEndpoint, authHeader, timeoutMs = 3e4 } = params;
|
|
19357
19815
|
if (!serviceEndpoint) {
|
|
@@ -19384,7 +19842,12 @@ async function mintAgentPkp(params) {
|
|
|
19384
19842
|
`Agent PKP mint returned no address: ${data.error ?? JSON.stringify(data)}`
|
|
19385
19843
|
);
|
|
19386
19844
|
}
|
|
19387
|
-
|
|
19845
|
+
if (typeof data.agentConsent !== "string" || !/^0x[0-9a-fA-F]{130}$/.test(data.agentConsent)) {
|
|
19846
|
+
throw new Error(
|
|
19847
|
+
`Agent PKP mint returned no binding consent for ${data.walletAddress} \u2014 the server predates AgentDelegationRegistry 3.0.0, which cannot bind an agent without one`
|
|
19848
|
+
);
|
|
19849
|
+
}
|
|
19850
|
+
return { walletAddress: data.walletAddress, agentConsent: data.agentConsent };
|
|
19388
19851
|
} finally {
|
|
19389
19852
|
clearTimeout(timeout);
|
|
19390
19853
|
}
|
|
@@ -19426,7 +19889,7 @@ async function describeProviderChainMismatch(provider, chainId) {
|
|
|
19426
19889
|
}
|
|
19427
19890
|
|
|
19428
19891
|
// src/utils/sign-guard/psm-exchange.ts
|
|
19429
|
-
var
|
|
19892
|
+
var import_ethers21 = require("ethers");
|
|
19430
19893
|
|
|
19431
19894
|
// src/utils/sign-guard/errors.ts
|
|
19432
19895
|
var TxValidationError = class extends Error {
|
|
@@ -19441,7 +19904,7 @@ var TxValidationError = class extends Error {
|
|
|
19441
19904
|
};
|
|
19442
19905
|
|
|
19443
19906
|
// src/utils/sign-guard/signable-functions.ts
|
|
19444
|
-
var
|
|
19907
|
+
var import_ethers19 = require("ethers");
|
|
19445
19908
|
var SIGNABLE_FUNCTIONS = [
|
|
19446
19909
|
"function mintUCD(bytes32 positionId, uint256 mintAmount, uint256 mintFee, uint256 newDebt, uint256 newCollateral, uint256 btcPrice, bytes32 authorizedSpendsHash, bytes32 ucdDebtHash, bytes32 contractHash, uint256 quantumTimestamp, bytes calldata mintValidatorSignature) external returns (bool)",
|
|
19447
19910
|
// `makePayment` is the ONLY repayment entry point. A `repayPosition` entry
|
|
@@ -19478,7 +19941,7 @@ var SIGNABLE_FUNCTIONS = [
|
|
|
19478
19941
|
// this too is client-only and never module-whitelisted.
|
|
19479
19942
|
"function addAddress(string btcAddress) external"
|
|
19480
19943
|
];
|
|
19481
|
-
var IFACE = new
|
|
19944
|
+
var IFACE = new import_ethers19.ethers.Interface(SIGNABLE_FUNCTIONS);
|
|
19482
19945
|
function encodeSignable(fn, args) {
|
|
19483
19946
|
return IFACE.encodeFunctionData(fn, args);
|
|
19484
19947
|
}
|
|
@@ -19501,12 +19964,12 @@ function decodeSignable(data) {
|
|
|
19501
19964
|
}
|
|
19502
19965
|
|
|
19503
19966
|
// src/utils/sign-guard/tx-validator.ts
|
|
19504
|
-
var
|
|
19967
|
+
var import_ethers20 = require("ethers");
|
|
19505
19968
|
function eqAddr(a, b) {
|
|
19506
19969
|
if (!a || !b)
|
|
19507
19970
|
return false;
|
|
19508
19971
|
try {
|
|
19509
|
-
return
|
|
19972
|
+
return import_ethers20.ethers.getAddress(a) === import_ethers20.ethers.getAddress(b);
|
|
19510
19973
|
} catch {
|
|
19511
19974
|
return false;
|
|
19512
19975
|
}
|
|
@@ -19572,7 +20035,7 @@ function readValue(tx) {
|
|
|
19572
20035
|
}
|
|
19573
20036
|
function normalizePositionId(id) {
|
|
19574
20037
|
const hex = id.startsWith("0x") ? id : `0x${id}`;
|
|
19575
|
-
return
|
|
20038
|
+
return import_ethers20.ethers.zeroPadValue(hex, 32).toLowerCase();
|
|
19576
20039
|
}
|
|
19577
20040
|
function requirePositionId(actual, expected) {
|
|
19578
20041
|
const txPositionId = String(actual).toLowerCase();
|
|
@@ -19866,18 +20329,18 @@ function buildPsmRedeemTx(p) {
|
|
|
19866
20329
|
var PSM_READS_ABI = ["function supportedStablecoins(address) view returns (bool)"];
|
|
19867
20330
|
var ERC20_READS_ABI = ["function allowance(address owner, address spender) view returns (uint256)"];
|
|
19868
20331
|
function psmExchangeReadsFromProvider(provider, psmAddress) {
|
|
19869
|
-
const psm = new
|
|
20332
|
+
const psm = new import_ethers21.ethers.Contract(psmAddress, PSM_READS_ABI, provider);
|
|
19870
20333
|
return {
|
|
19871
20334
|
isStablecoinSupported: async (stablecoin) => await psm.getFunction("supportedStablecoins")(stablecoin),
|
|
19872
|
-
allowance: async (token, owner, spender) => await new
|
|
20335
|
+
allowance: async (token, owner, spender) => await new import_ethers21.ethers.Contract(token, ERC20_READS_ABI, provider).getFunction("allowance")(owner, spender)
|
|
19873
20336
|
};
|
|
19874
20337
|
}
|
|
19875
20338
|
var refuse = (direction, msg) => new TxValidationError(msg, `PSM ${direction}`);
|
|
19876
20339
|
function requireAddress(direction, label, value) {
|
|
19877
|
-
if (!value || !
|
|
20340
|
+
if (!value || !import_ethers21.ethers.isAddress(value)) {
|
|
19878
20341
|
throw refuse(direction, `${label} address is missing or invalid (${String(value)})`);
|
|
19879
20342
|
}
|
|
19880
|
-
return
|
|
20343
|
+
return import_ethers21.ethers.getAddress(value);
|
|
19881
20344
|
}
|
|
19882
20345
|
async function planPsmExchange(params) {
|
|
19883
20346
|
const { direction, amountIn, minOut, vctx, reads } = params;
|
|
@@ -20205,7 +20668,7 @@ function formatLiquidationFailureMessage(loanId, errorMessage, btcVault, btcVaul
|
|
|
20205
20668
|
}
|
|
20206
20669
|
|
|
20207
20670
|
// src/utils/contract-error-decoder.ts
|
|
20208
|
-
var
|
|
20671
|
+
var import_ethers22 = require("ethers");
|
|
20209
20672
|
|
|
20210
20673
|
// src/constants/chunks/contract-errors.generated.ts
|
|
20211
20674
|
var CONTRACT_ERROR_FRAGMENTS = [
|
|
@@ -20458,7 +20921,7 @@ function contractErrorTable() {
|
|
|
20458
20921
|
if (TABLE)
|
|
20459
20922
|
return TABLE;
|
|
20460
20923
|
const table = /* @__PURE__ */ new Map();
|
|
20461
|
-
const iface = new
|
|
20924
|
+
const iface = new import_ethers22.Interface(CONTRACT_ERROR_FRAGMENTS.map((e) => e.fragment));
|
|
20462
20925
|
const contractsByName = new Map(
|
|
20463
20926
|
CONTRACT_ERROR_FRAGMENTS.map((e) => [e.fragment.slice("error ".length, e.fragment.indexOf("(")), e.contracts])
|
|
20464
20927
|
);
|
|
@@ -20551,7 +21014,7 @@ function decodeContractError(error) {
|
|
|
20551
21014
|
const contract = entry.contracts.join(" | ");
|
|
20552
21015
|
let args = [];
|
|
20553
21016
|
try {
|
|
20554
|
-
const decoded = new
|
|
21017
|
+
const decoded = new import_ethers22.Interface([entry.fragment]).decodeErrorResult(entry.fragment, errorData);
|
|
20555
21018
|
args = Array.from(decoded);
|
|
20556
21019
|
} catch {
|
|
20557
21020
|
args = [];
|
|
@@ -20875,10 +21338,11 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
20875
21338
|
* from live chain state so a half-done ceremony resumes.
|
|
20876
21339
|
*
|
|
20877
21340
|
* Service-mode only — the server holds the Chipotle account that mints the
|
|
20878
|
-
* PKP and it gates the route to current Safe owners. `knownAgentAddress`
|
|
20879
|
-
* the caller-persisted agent
|
|
20880
|
-
*
|
|
20881
|
-
* restart.
|
|
21341
|
+
* PKP and it gates the route to current Safe owners. `knownAgentAddress` +
|
|
21342
|
+
* `knownAgentConsent` are the caller-persisted agent and its binding consent
|
|
21343
|
+
* from an earlier prepare whose ceremony has not landed yet; echoing them back
|
|
21344
|
+
* prevents a duplicate mint after a server restart. The server reuses an
|
|
21345
|
+
* address only with a consent that verifies for this Safe (issue #1197).
|
|
20882
21346
|
*/
|
|
20883
21347
|
async prepareSafeAgentModule(request) {
|
|
20884
21348
|
if (this.config.mode !== "service") {
|
|
@@ -20902,7 +21366,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
20902
21366
|
signal: abort.signal,
|
|
20903
21367
|
body: JSON.stringify({
|
|
20904
21368
|
safeAddress: request.safeAddress,
|
|
20905
|
-
...request.knownAgentAddress ? { knownAgentAddress: request.knownAgentAddress } : {}
|
|
21369
|
+
...request.knownAgentAddress ? { knownAgentAddress: request.knownAgentAddress } : {},
|
|
21370
|
+
...request.knownAgentConsent ? { knownAgentConsent: request.knownAgentConsent } : {}
|
|
20906
21371
|
})
|
|
20907
21372
|
}
|
|
20908
21373
|
);
|
|
@@ -20919,9 +21384,21 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
20919
21384
|
`prepareSafeAgentModule failed (${resp.status}): ${data?.error ?? "no error detail from server"}`
|
|
20920
21385
|
);
|
|
20921
21386
|
}
|
|
21387
|
+
const selectors = data.calls.map((c) => c.data.slice(0, 10).toLowerCase());
|
|
21388
|
+
if (selectors.some((s) => s === "0x561b7f8a" || s === "0xfd437d39")) {
|
|
21389
|
+
throw new Error(
|
|
21390
|
+
"prepareSafeAgentModule returned a 3-argument registerAgent/rotateAgent \u2014 the delegation server predates AgentDelegationRegistry 3.0.0, which would revert it"
|
|
21391
|
+
);
|
|
21392
|
+
}
|
|
21393
|
+
if (selectors.some((s) => s === "0xc040b8ae" || s === "0xfcc1f21a") && typeof data.agentConsent !== "string") {
|
|
21394
|
+
throw new Error(
|
|
21395
|
+
"prepareSafeAgentModule returned a registration without the agent's binding consent"
|
|
21396
|
+
);
|
|
21397
|
+
}
|
|
20922
21398
|
return {
|
|
20923
21399
|
status: data.status,
|
|
20924
21400
|
agentAddress: data.agentAddress,
|
|
21401
|
+
agentConsent: data.agentConsent ?? null,
|
|
20925
21402
|
moduleAddress: data.moduleAddress,
|
|
20926
21403
|
validUntil: data.validUntil,
|
|
20927
21404
|
calls: data.calls
|
|
@@ -21114,7 +21591,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
21114
21591
|
*/
|
|
21115
21592
|
constructor(config) {
|
|
21116
21593
|
if (!config.provider && config.ethRpcUrl) {
|
|
21117
|
-
config.provider = new
|
|
21594
|
+
config.provider = new import_ethers23.JsonRpcProvider(config.ethRpcUrl);
|
|
21118
21595
|
}
|
|
21119
21596
|
this.config = config;
|
|
21120
21597
|
if (config.debug) {
|
|
@@ -21406,7 +21883,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
21406
21883
|
const network = await config.provider.getNetwork();
|
|
21407
21884
|
chainId = Number(network.chainId);
|
|
21408
21885
|
} else if (config.ethRpcUrl) {
|
|
21409
|
-
const tempProvider = new
|
|
21886
|
+
const tempProvider = new import_ethers23.JsonRpcProvider(
|
|
21410
21887
|
config.ethRpcUrl
|
|
21411
21888
|
);
|
|
21412
21889
|
const network = await tempProvider.getNetwork();
|
|
@@ -21934,6 +22411,14 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
21934
22411
|
}
|
|
21935
22412
|
}
|
|
21936
22413
|
async _requestMintUCDAttempt(request) {
|
|
22414
|
+
if (request.debugOverrides !== void 0) {
|
|
22415
|
+
throw new SDKError({
|
|
22416
|
+
code: "SDK_DEBUG_OVERRIDES_REMOVED",
|
|
22417
|
+
message: "debugOverrides is not supported: BTC stub mode was removed from the mint validator",
|
|
22418
|
+
category: "VALIDATION" /* VALIDATION */,
|
|
22419
|
+
severity: "MEDIUM" /* MEDIUM */
|
|
22420
|
+
});
|
|
22421
|
+
}
|
|
21937
22422
|
try {
|
|
21938
22423
|
if (this.config.debug) {
|
|
21939
22424
|
log.info("\u{1FA99} Requesting UCD minting...", {});
|
|
@@ -21942,7 +22427,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
21942
22427
|
}
|
|
21943
22428
|
const loanOps = this.loanOps();
|
|
21944
22429
|
const protocolConfig = await loanOps.getProtocolConfig();
|
|
21945
|
-
const requestAmountWei = (0,
|
|
22430
|
+
const requestAmountWei = (0, import_ethers23.parseEther)(
|
|
21946
22431
|
request.amount.toString()
|
|
21947
22432
|
);
|
|
21948
22433
|
const minLoanValueWei = BigInt(protocolConfig.minimumLoanValueWei);
|
|
@@ -22044,12 +22529,12 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22044
22529
|
);
|
|
22045
22530
|
return {
|
|
22046
22531
|
success: false,
|
|
22047
|
-
error: `Amount ${request.amount} UCD plus the ${positionTerm.originationFeeBps / 100}% origination fee (${(0,
|
|
22532
|
+
error: `Amount ${request.amount} UCD plus the ${positionTerm.originationFeeBps / 100}% origination fee (${(0, import_ethers23.formatEther)(baseFeeWei)} UCD) would take this loan's debt to ${(0, import_ethers23.formatEther)(debtAfterWei)} UCD, above the protocol maximum of ${(0, import_ethers23.formatEther)(maxLoanValueWei)} UCD. The largest amount you can mint now is ${maxPrincipalUcd} UCD.`
|
|
22048
22533
|
};
|
|
22049
22534
|
}
|
|
22050
22535
|
if (this.config.debug) {
|
|
22051
22536
|
log.info(
|
|
22052
|
-
`\u2705 Fee-inclusive loan cap check passed: ${(0,
|
|
22537
|
+
`\u2705 Fee-inclusive loan cap check passed: ${(0, import_ethers23.formatEther)(currentDebtWei + requestAmountWei + baseFeeWei)} UCD <= ${(0, import_ethers23.formatEther)(maxLoanValueWei)} UCD`,
|
|
22053
22538
|
{}
|
|
22054
22539
|
);
|
|
22055
22540
|
}
|
|
@@ -22080,7 +22565,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22080
22565
|
pkpNftAddress,
|
|
22081
22566
|
this.getChipotlePublicKeyFallback()
|
|
22082
22567
|
);
|
|
22083
|
-
pkpEthAddress = (0,
|
|
22568
|
+
pkpEthAddress = (0, import_ethers23.computeAddress)(pkpPublicKey);
|
|
22084
22569
|
pkpCache.set(request.positionId, {
|
|
22085
22570
|
publicKey: pkpPublicKey,
|
|
22086
22571
|
ethAddress: pkpEthAddress,
|
|
@@ -22211,9 +22696,6 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22211
22696
|
} : {},
|
|
22212
22697
|
rpcUrl: request.rpcUrl || this.config.ethRpcUrl,
|
|
22213
22698
|
// Pass RPC URL to LIT Action (ngrok for Hardhat)
|
|
22214
|
-
...request.debugOverrides && {
|
|
22215
|
-
debugOverrides: request.debugOverrides
|
|
22216
|
-
},
|
|
22217
22699
|
...this.config.priceProviders && {
|
|
22218
22700
|
priceProviders: this.config.priceProviders
|
|
22219
22701
|
}
|
|
@@ -22423,8 +22905,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22423
22905
|
throw new Error(`Position not found: ${request.positionId}`);
|
|
22424
22906
|
}
|
|
22425
22907
|
const currentDebt = position.ucdDebt.toString();
|
|
22426
|
-
const ucdDebtHash = (0,
|
|
22427
|
-
const contractHash = (0,
|
|
22908
|
+
const ucdDebtHash = (0, import_ethers23.keccak256)(import_ethers23.AbiCoder.defaultAbiCoder().encode(["uint256"], [currentDebt]));
|
|
22909
|
+
const contractHash = (0, import_ethers23.keccak256)(import_ethers23.AbiCoder.defaultAbiCoder().encode(
|
|
22428
22910
|
["address", "address", "address", "address"],
|
|
22429
22911
|
[
|
|
22430
22912
|
positionManagerAddress,
|
|
@@ -22493,7 +22975,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22493
22975
|
const coreAbi = [
|
|
22494
22976
|
"function getPositionDetails(bytes32) view returns (tuple(bytes32 positionId, bytes32 pkpId, uint256 ucdDebt, string vaultAddress, address borrower, uint40 createdAt, uint40 lastUpdated, uint16 selectedTerm, uint40 expiryAt, uint8 status, uint40 previousExpiryAt, uint16 totalTerm))"
|
|
22495
22977
|
];
|
|
22496
|
-
const positionCore = new
|
|
22978
|
+
const positionCore = new import_ethers23.Contract(
|
|
22497
22979
|
coreAddress,
|
|
22498
22980
|
coreAbi,
|
|
22499
22981
|
this.getSignerOrThrow().provider
|
|
@@ -22501,8 +22983,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22501
22983
|
const currentPosition = await positionCore["getPositionDetails"](
|
|
22502
22984
|
positionIdBytes32
|
|
22503
22985
|
);
|
|
22504
|
-
const currentDebtHash = (0,
|
|
22505
|
-
|
|
22986
|
+
const currentDebtHash = (0, import_ethers23.keccak256)(
|
|
22987
|
+
import_ethers23.AbiCoder.defaultAbiCoder().encode(
|
|
22506
22988
|
["uint256"],
|
|
22507
22989
|
[currentPosition.ucdDebt]
|
|
22508
22990
|
)
|
|
@@ -22549,7 +23031,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22549
23031
|
"function getCurrentQuantum() view returns (uint256)",
|
|
22550
23032
|
"function isQuantumValid(bytes32,uint256) view returns (bool)"
|
|
22551
23033
|
];
|
|
22552
|
-
const registry = new
|
|
23034
|
+
const registry = new import_ethers23.Contract(
|
|
22553
23035
|
registryAddress,
|
|
22554
23036
|
registryAbi,
|
|
22555
23037
|
this.getSignerOrThrow().provider
|
|
@@ -22665,7 +23147,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22665
23147
|
});
|
|
22666
23148
|
}
|
|
22667
23149
|
const signatureHexMint = finalSignature.startsWith("0x") ? finalSignature : "0x" + finalSignature;
|
|
22668
|
-
const mintIface = new
|
|
23150
|
+
const mintIface = new import_ethers23.Interface(positionManagerAbi);
|
|
22669
23151
|
const mintCalldata = mintIface.encodeFunctionData("mintUCD", [
|
|
22670
23152
|
positionIdBytes32,
|
|
22671
23153
|
validationResponse.mintAmount,
|
|
@@ -22701,7 +23183,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
22701
23183
|
if (viewsAddress) {
|
|
22702
23184
|
let diagnosis = null;
|
|
22703
23185
|
try {
|
|
22704
|
-
const views = new
|
|
23186
|
+
const views = new import_ethers23.Contract(
|
|
22705
23187
|
viewsAddress,
|
|
22706
23188
|
[
|
|
22707
23189
|
"function diagnoseMintUCD(bytes32,uint256,uint256,uint256,uint256,uint256,bytes32,bytes32,bytes32,uint256,bytes) view returns (string)"
|
|
@@ -22759,7 +23241,7 @@ MintGuardFailed(${guardCode}): ${guardMeaning}
|
|
|
22759
23241
|
Lit mintAmount: ${validationResponse.mintAmount}
|
|
22760
23242
|
Lit mintFee: ${validationResponse.mintFee}
|
|
22761
23243
|
Lit newDebt: ${validationResponse.newDebt}
|
|
22762
|
-
Protocol maximum: ${(0,
|
|
23244
|
+
Protocol maximum: ${(0, import_ethers23.formatEther)(maxLoanValueWei)} UCD (fee-inclusive)`;
|
|
22763
23245
|
}
|
|
22764
23246
|
const mintDebtDiagnostics = selector === "0xb9d419a7" || // DebtUpdateVerificationFailed()
|
|
22765
23247
|
selector === "0xc7e20553" || // DebtUpdateVerificationFailedDetailed(...)
|
|
@@ -22830,7 +23312,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
22830
23312
|
if (receipt.logs && receipt.logs.length > 0) {
|
|
22831
23313
|
for (const receiptLog of receipt.logs) {
|
|
22832
23314
|
if (receiptLog.topics && receiptLog.topics[0] === "0x08c379a0") {
|
|
22833
|
-
const iface = new
|
|
23315
|
+
const iface = new import_ethers23.Interface([
|
|
22834
23316
|
"error Error(string)"
|
|
22835
23317
|
]);
|
|
22836
23318
|
const decoded = iface.decodeErrorResult("Error", receiptLog.data);
|
|
@@ -22847,7 +23329,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
22847
23329
|
const minimalAbi = [
|
|
22848
23330
|
"event UCDMintedWithAuthorization(bytes32 indexed positionId, address indexed borrower, uint256 mintAmount, uint256 mintFee, uint256 newDebt, uint256 newCollateral, uint256 btcPrice, uint256 quantumTimestamp, bytes32 authorizedSpendsHash)"
|
|
22849
23331
|
];
|
|
22850
|
-
const iface = new
|
|
23332
|
+
const iface = new import_ethers23.Interface(minimalAbi);
|
|
22851
23333
|
for (const receiptLog of receipt.logs) {
|
|
22852
23334
|
const parsed = (() => {
|
|
22853
23335
|
const logIface = iface;
|
|
@@ -23015,7 +23497,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
23015
23497
|
pkpNftAddress,
|
|
23016
23498
|
this.getChipotlePublicKeyFallback()
|
|
23017
23499
|
);
|
|
23018
|
-
const pkpEthAddress = (0,
|
|
23500
|
+
const pkpEthAddress = (0, import_ethers23.computeAddress)(pkpPublicKey);
|
|
23019
23501
|
pkpData = {
|
|
23020
23502
|
publicKey: pkpPublicKey,
|
|
23021
23503
|
ethAddress: pkpEthAddress,
|
|
@@ -23413,7 +23895,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
23413
23895
|
}
|
|
23414
23896
|
const loanOpsForUcd = loanOpsForUcdResult.value;
|
|
23415
23897
|
const ucdTokenAddress = await loanOpsForUcd.ucdToken();
|
|
23416
|
-
const ucdToken = new
|
|
23898
|
+
const ucdToken = new import_ethers23.Contract(
|
|
23417
23899
|
ucdTokenAddress,
|
|
23418
23900
|
[
|
|
23419
23901
|
"function balanceOf(address) view returns (uint256)",
|
|
@@ -23429,9 +23911,9 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
23429
23911
|
if (ucdBalance < debtWei) {
|
|
23430
23912
|
return {
|
|
23431
23913
|
success: false,
|
|
23432
|
-
error: `Insufficient UCD balance for liquidation: ${(0,
|
|
23914
|
+
error: `Insufficient UCD balance for liquidation: ${(0, import_ethers23.formatEther)(
|
|
23433
23915
|
ucdBalance
|
|
23434
|
-
)} UCD (need ${(0,
|
|
23916
|
+
)} UCD (need ${(0, import_ethers23.formatEther)(debtWei)} UCD)`,
|
|
23435
23917
|
positionId: request.positionId,
|
|
23436
23918
|
wasLiquidated: false
|
|
23437
23919
|
};
|
|
@@ -23440,7 +23922,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
23440
23922
|
if (request.skipUcdApproval) {
|
|
23441
23923
|
return {
|
|
23442
23924
|
success: false,
|
|
23443
|
-
error: `Insufficient UCD allowance for UCDController: need at least ${(0,
|
|
23925
|
+
error: `Insufficient UCD allowance for UCDController: need at least ${(0, import_ethers23.formatEther)(
|
|
23444
23926
|
debtWei
|
|
23445
23927
|
)} UCD, or omit skipUcdApproval to let the SDK submit approve`,
|
|
23446
23928
|
positionId: request.positionId,
|
|
@@ -23965,7 +24447,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
23965
24447
|
if (typeof signatureBytes === "string" && signatureBytes.startsWith("{")) {
|
|
23966
24448
|
try {
|
|
23967
24449
|
const parsed = JSON.parse(signatureBytes);
|
|
23968
|
-
signatureBytes = parsed.signature ?? (parsed.r && parsed.s && parsed.v ?
|
|
24450
|
+
signatureBytes = parsed.signature ?? (parsed.r && parsed.s && parsed.v ? import_ethers23.Signature.from({
|
|
23969
24451
|
r: parsed.r,
|
|
23970
24452
|
s: parsed.s,
|
|
23971
24453
|
v: parsed.v
|
|
@@ -23976,7 +24458,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
23976
24458
|
if (!signatureBytes.startsWith("0x")) {
|
|
23977
24459
|
signatureBytes = "0x" + signatureBytes;
|
|
23978
24460
|
}
|
|
23979
|
-
const extendIface = new
|
|
24461
|
+
const extendIface = new import_ethers23.Interface([
|
|
23980
24462
|
"function extendPosition(bytes32 positionId, uint256 selectedTerm, uint256 quantumTimestamp, uint256 btcPrice, uint256 availableBTCBalance, uint256 proRataRenewalFee, bytes calldata extensionValidatorSignature) external returns (bool)"
|
|
23981
24463
|
]);
|
|
23982
24464
|
const extendCalldata = extendIface.encodeFunctionData("extendPosition", [
|
|
@@ -24525,7 +25007,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
24525
25007
|
` Converting payment amount: ${request.paymentAmount} (type: ${typeof request.paymentAmount})`
|
|
24526
25008
|
);
|
|
24527
25009
|
}
|
|
24528
|
-
const paymentAmountWei = (0,
|
|
25010
|
+
const paymentAmountWei = (0, import_ethers23.parseEther)(
|
|
24529
25011
|
request.paymentAmount.toString()
|
|
24530
25012
|
);
|
|
24531
25013
|
if (this.config.debug) {
|
|
@@ -24592,7 +25074,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
24592
25074
|
};
|
|
24593
25075
|
}
|
|
24594
25076
|
const ucdTokenAddress = await loanOps.ucdToken();
|
|
24595
|
-
const ucdToken = new
|
|
25077
|
+
const ucdToken = new import_ethers23.Contract(
|
|
24596
25078
|
ucdTokenAddress,
|
|
24597
25079
|
[
|
|
24598
25080
|
"function balanceOf(address) view returns (uint256)",
|
|
@@ -24616,14 +25098,14 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
24616
25098
|
]);
|
|
24617
25099
|
if (this.config.debug) {
|
|
24618
25100
|
log.info(` UCD funds source: ${fundsSource}${isSelfRepay ? " (self)" : " (borrower; agent submitting)"}`);
|
|
24619
|
-
log.info(` UCD Balance: ${(0,
|
|
24620
|
-
log.info(` UCD Allowance: ${(0,
|
|
25101
|
+
log.info(` UCD Balance: ${(0, import_ethers23.formatEther)(balance)} UCD`);
|
|
25102
|
+
log.info(` UCD Allowance: ${(0, import_ethers23.formatEther)(allowance)} UCD`);
|
|
24621
25103
|
log.info(` Required: ${request.paymentAmount} UCD`);
|
|
24622
25104
|
}
|
|
24623
25105
|
if (balance < paymentAmountWei) {
|
|
24624
25106
|
return {
|
|
24625
25107
|
success: false,
|
|
24626
|
-
error: `Insufficient UCD balance: ${(0,
|
|
25108
|
+
error: `Insufficient UCD balance: ${(0, import_ethers23.formatEther)(
|
|
24627
25109
|
balance
|
|
24628
25110
|
)} UCD (need ${request.paymentAmount} UCD)${isSelfRepay ? "" : ` \u2014 borrower ${fundsSource} lacks funds`}`
|
|
24629
25111
|
};
|
|
@@ -24632,7 +25114,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
24632
25114
|
if (!isSelfRepay) {
|
|
24633
25115
|
return {
|
|
24634
25116
|
success: false,
|
|
24635
|
-
error: `Borrower ${fundsSource} has insufficient UCD allowance to PositionManager (${(0,
|
|
25117
|
+
error: `Borrower ${fundsSource} has insufficient UCD allowance to PositionManager (${(0, import_ethers23.formatEther)(allowance)} UCD, need ${request.paymentAmount}). The borrower must approve PositionManager before a delegated agent can repay.`
|
|
24636
25118
|
};
|
|
24637
25119
|
}
|
|
24638
25120
|
if (this.config.debug) {
|
|
@@ -24901,7 +25383,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
24901
25383
|
const paymentSigner = this.getSignerOrThrow();
|
|
24902
25384
|
const paymentFrom = await paymentSigner.getAddress();
|
|
24903
25385
|
const paymentProvider = contractManager.getProvider();
|
|
24904
|
-
const paymentIface = new
|
|
25386
|
+
const paymentIface = new import_ethers23.Interface([
|
|
24905
25387
|
"function makePayment(bytes32 positionId, uint256 paymentAmount, uint256 quantumTimestamp, uint256 btcPrice, bytes calldata paymentValidatorSignature) external returns (bool)"
|
|
24906
25388
|
]);
|
|
24907
25389
|
const paymentCalldata = paymentIface.encodeFunctionData("makePayment", [
|
|
@@ -25201,6 +25683,11 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25201
25683
|
error: "Invalid withdrawal address"
|
|
25202
25684
|
};
|
|
25203
25685
|
}
|
|
25686
|
+
const caseError = bitcoinAddressCaseError(withdrawalAddress);
|
|
25687
|
+
if (caseError) {
|
|
25688
|
+
return { success: false, error: caseError };
|
|
25689
|
+
}
|
|
25690
|
+
withdrawalAddress = normalizeBitcoinAddress(withdrawalAddress);
|
|
25204
25691
|
try {
|
|
25205
25692
|
const btcNetwork = this.bitcoinOperations.getNetwork();
|
|
25206
25693
|
safeValidateBitcoinAddress(withdrawalAddress.trim(), btcNetwork);
|
|
@@ -25250,7 +25737,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25250
25737
|
const pkpId = position.pkpId;
|
|
25251
25738
|
if (litValidatorAddr && pkpId) {
|
|
25252
25739
|
try {
|
|
25253
|
-
const litValidator = new
|
|
25740
|
+
const litValidator = new import_ethers23.Contract(
|
|
25254
25741
|
litValidatorAddr,
|
|
25255
25742
|
["function pkpOwners(bytes32) view returns (address)"],
|
|
25256
25743
|
this.getProviderOrThrow()
|
|
@@ -25258,7 +25745,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25258
25745
|
const owner = await litValidator.pkpOwners(
|
|
25259
25746
|
pkpId
|
|
25260
25747
|
);
|
|
25261
|
-
if (owner && owner !==
|
|
25748
|
+
if (owner && owner !== import_ethers23.ZeroAddress) {
|
|
25262
25749
|
controller = owner;
|
|
25263
25750
|
}
|
|
25264
25751
|
} catch {
|
|
@@ -25310,7 +25797,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25310
25797
|
pkpNftAddress,
|
|
25311
25798
|
this.getChipotlePublicKeyFallback()
|
|
25312
25799
|
);
|
|
25313
|
-
pkpEthAddress = (0,
|
|
25800
|
+
pkpEthAddress = (0, import_ethers23.computeAddress)(pkpPublicKey);
|
|
25314
25801
|
pkpCache.set(positionId, {
|
|
25315
25802
|
publicKey: pkpPublicKey,
|
|
25316
25803
|
ethAddress: pkpEthAddress,
|
|
@@ -25683,7 +26170,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25683
26170
|
utxoVout: withdrawalParams.utxoVout
|
|
25684
26171
|
});
|
|
25685
26172
|
}
|
|
25686
|
-
const withdrawIface = new
|
|
26173
|
+
const withdrawIface = new import_ethers23.Interface([
|
|
25687
26174
|
"function withdrawBTC((bytes32 positionId, bytes32 actionHash, bytes32 authorizedSpendsHash, bytes32 ucdDebtHash, bytes32 contractBundleHash, string withdrawalAddress, uint256 totalDeduction, uint256 newCollateral, uint256 quantumTimestamp, uint256 btcPrice, string utxoTxid, uint32 utxoVout) params, bytes withdrawalValidatorSignature, bytes btcSpendAuthSignature) external returns (bool)"
|
|
25688
26175
|
]);
|
|
25689
26176
|
const withdrawCalldata = withdrawIface.encodeFunctionData("withdrawBTC", [
|
|
@@ -25914,7 +26401,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25914
26401
|
}
|
|
25915
26402
|
const pkpId = positionDetails.pkpId;
|
|
25916
26403
|
const vaultAddress = positionDetails.vaultAddress;
|
|
25917
|
-
if (!pkpId || pkpId ===
|
|
26404
|
+
if (!pkpId || pkpId === import_ethers23.ZeroHash) {
|
|
25918
26405
|
return { success: false, error: "Position has no PKP" };
|
|
25919
26406
|
}
|
|
25920
26407
|
if (!vaultAddress) {
|
|
@@ -25934,7 +26421,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
25934
26421
|
if (!publicKey) {
|
|
25935
26422
|
return { success: false, error: "Failed to resolve PKP public key" };
|
|
25936
26423
|
}
|
|
25937
|
-
const chipotlePkpAddress = (0,
|
|
26424
|
+
const chipotlePkpAddress = (0, import_ethers23.computeAddress)(publicKey);
|
|
25938
26425
|
const chainName = LIT_ACTION_CHAIN_NAMES[chainId];
|
|
25939
26426
|
if (!chainName) {
|
|
25940
26427
|
return {
|
|
@@ -26154,6 +26641,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26154
26641
|
networkFee: request.networkFee,
|
|
26155
26642
|
chainId,
|
|
26156
26643
|
signer,
|
|
26644
|
+
provider: this.getProviderOrThrow(),
|
|
26157
26645
|
...executionUtxos ? { utxos: executionUtxos } : {}
|
|
26158
26646
|
});
|
|
26159
26647
|
if (this.config.mode !== "service") {
|
|
@@ -26306,8 +26794,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26306
26794
|
});
|
|
26307
26795
|
}
|
|
26308
26796
|
const contractAddresses = this.getContractAddressesOrThrow();
|
|
26309
|
-
const
|
|
26310
|
-
if (!
|
|
26797
|
+
const btcSpendAuthorizerAddress2 = contractAddresses.btcSpendAuthorizer;
|
|
26798
|
+
if (!btcSpendAuthorizerAddress2) {
|
|
26311
26799
|
return [
|
|
26312
26800
|
{
|
|
26313
26801
|
success: false,
|
|
@@ -26318,8 +26806,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26318
26806
|
const btcSpendAuthorizerAbi = [
|
|
26319
26807
|
"function getAuthorizedSpends(bytes32) view returns (tuple(string txid, uint32 vout, uint256 satoshis, string targetAddress, uint256 targetAmount, uint256 authorizedAt)[])"
|
|
26320
26808
|
];
|
|
26321
|
-
const btcSpendAuthorizer = new
|
|
26322
|
-
|
|
26809
|
+
const btcSpendAuthorizer = new import_ethers23.Contract(
|
|
26810
|
+
btcSpendAuthorizerAddress2,
|
|
26323
26811
|
btcSpendAuthorizerAbi,
|
|
26324
26812
|
this.getProviderOrThrow()
|
|
26325
26813
|
);
|
|
@@ -26345,7 +26833,9 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26345
26833
|
const result = await this.executeBTCWithdrawal({
|
|
26346
26834
|
positionId,
|
|
26347
26835
|
utxoIdentifier,
|
|
26348
|
-
|
|
26836
|
+
// uint256 decodes to bigint; the Phase-2 request is JSON-serialized, so a bigint
|
|
26837
|
+
// here failed every retry with "Do not know how to serialize a BigInt".
|
|
26838
|
+
utxoSatoshis: Number(spend.satoshis),
|
|
26349
26839
|
networkFee,
|
|
26350
26840
|
destination: spend.targetAddress,
|
|
26351
26841
|
// CRIT-1: bind the on-chain-authorized targetAmount into the
|
|
@@ -26391,8 +26881,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26391
26881
|
async getPendingWithdrawals(positionId) {
|
|
26392
26882
|
this.ensureInitialized();
|
|
26393
26883
|
const contractAddresses = this.getContractAddressesOrThrow();
|
|
26394
|
-
const
|
|
26395
|
-
if (!
|
|
26884
|
+
const btcSpendAuthorizerAddress2 = contractAddresses.btcSpendAuthorizer;
|
|
26885
|
+
if (!btcSpendAuthorizerAddress2) {
|
|
26396
26886
|
throw new SDKError({
|
|
26397
26887
|
code: "SDK_CONTRACT_ADDRESSES_NOT_CONFIGURED",
|
|
26398
26888
|
message: "BTCSpendAuthorizer address not configured",
|
|
@@ -26404,8 +26894,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26404
26894
|
const abi = [
|
|
26405
26895
|
"function getAuthorizedSpends(bytes32) view returns (tuple(string txid, uint32 vout, uint256 satoshis, string targetAddress, uint256 targetAmount, uint256 authorizedAt)[])"
|
|
26406
26896
|
];
|
|
26407
|
-
const contract = new
|
|
26408
|
-
|
|
26897
|
+
const contract = new import_ethers23.Contract(
|
|
26898
|
+
btcSpendAuthorizerAddress2,
|
|
26409
26899
|
abi,
|
|
26410
26900
|
this.getProviderOrThrow()
|
|
26411
26901
|
);
|
|
@@ -26418,7 +26908,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26418
26908
|
targetAddress: spend.targetAddress,
|
|
26419
26909
|
targetAmount: Number(spend.targetAmount),
|
|
26420
26910
|
authorizedAt: Number(spend.authorizedAt),
|
|
26421
|
-
utxoKey: (0,
|
|
26911
|
+
utxoKey: (0, import_ethers23.solidityPackedKeccak256)(
|
|
26422
26912
|
["string", "uint32"],
|
|
26423
26913
|
[spend.txid, Number(spend.vout)]
|
|
26424
26914
|
)
|
|
@@ -26507,8 +26997,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26507
26997
|
this.ensureInitialized();
|
|
26508
26998
|
try {
|
|
26509
26999
|
const contractAddresses = this.getContractAddressesOrThrow();
|
|
26510
|
-
const
|
|
26511
|
-
if (!
|
|
27000
|
+
const btcSpendAuthorizerAddress2 = contractAddresses.btcSpendAuthorizer;
|
|
27001
|
+
if (!btcSpendAuthorizerAddress2) {
|
|
26512
27002
|
return {
|
|
26513
27003
|
success: false,
|
|
26514
27004
|
failedStep: "config",
|
|
@@ -26598,7 +27088,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26598
27088
|
invalidatorTxid: params.invalidatorTxid,
|
|
26599
27089
|
contractAddresses: {
|
|
26600
27090
|
PositionManager: contractAddresses.positionManager,
|
|
26601
|
-
BTCSpendAuthorizer:
|
|
27091
|
+
BTCSpendAuthorizer: btcSpendAuthorizerAddress2,
|
|
26602
27092
|
...contractAddresses.bitcoinProviderRegistry && {
|
|
26603
27093
|
BitcoinProviderRegistry: contractAddresses.bitcoinProviderRegistry
|
|
26604
27094
|
}
|
|
@@ -26624,8 +27114,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26624
27114
|
error: attRes.error ?? attRes.reason ?? `LIT recovery attestation rejected${attRes.failedStep ? ` at step ${attRes.failedStep}` : ""}`
|
|
26625
27115
|
};
|
|
26626
27116
|
}
|
|
26627
|
-
const btcSpendAuthorizer = new
|
|
26628
|
-
|
|
27117
|
+
const btcSpendAuthorizer = new import_ethers23.Contract(
|
|
27118
|
+
btcSpendAuthorizerAddress2,
|
|
26629
27119
|
[
|
|
26630
27120
|
"function cancelStaleSpendWithProof(bytes32 positionId, bytes32 utxoKey, uint256 authorizedAt, string calldata invalidatorTxid, uint256 attestationTimestamp, bytes calldata litSignature) external"
|
|
26631
27121
|
],
|
|
@@ -26679,7 +27169,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26679
27169
|
utxoTxid: params.utxoTxid,
|
|
26680
27170
|
utxoVout: params.utxoVout,
|
|
26681
27171
|
chainId,
|
|
26682
|
-
signer
|
|
27172
|
+
signer,
|
|
27173
|
+
provider: this.getProviderOrThrow()
|
|
26683
27174
|
});
|
|
26684
27175
|
if (this.config.mode === "service" && this.config.serviceEndpoint) {
|
|
26685
27176
|
const headers = {
|
|
@@ -26721,7 +27212,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26721
27212
|
const positionDetails = await this.getPositionDetailsView(
|
|
26722
27213
|
params.positionId
|
|
26723
27214
|
);
|
|
26724
|
-
if (!positionDetails?.pkpId || positionDetails.pkpId ===
|
|
27215
|
+
if (!positionDetails?.pkpId || positionDetails.pkpId === import_ethers23.ZeroHash) {
|
|
26725
27216
|
return { success: false, error: "Position has no PKP" };
|
|
26726
27217
|
}
|
|
26727
27218
|
const pkpCache = this.cacheManager.getCache("pkp-data", {
|
|
@@ -26738,7 +27229,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26738
27229
|
if (!publicKey) {
|
|
26739
27230
|
return { success: false, error: "Failed to resolve PKP public key" };
|
|
26740
27231
|
}
|
|
26741
|
-
const chipotlePkpAddress = (0,
|
|
27232
|
+
const chipotlePkpAddress = (0, import_ethers23.computeAddress)(publicKey);
|
|
26742
27233
|
const dc = this.config.contractAddresses || {};
|
|
26743
27234
|
const chainName = chainId === 1 ? "ethereum" : chainId === 11155111 ? "sepolia" : chainId === 1337 || chainId === 31337 ? "hardhat" : void 0;
|
|
26744
27235
|
if (!chainName) {
|
|
@@ -26924,6 +27415,14 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
26924
27415
|
if (typeof positionId !== "string" || !positionId) {
|
|
26925
27416
|
return { success: false, error: "positionId is required" };
|
|
26926
27417
|
}
|
|
27418
|
+
if (typeof withdrawalAddress !== "string" || withdrawalAddress.trim().length === 0) {
|
|
27419
|
+
return { success: false, error: "withdrawalAddress is required" };
|
|
27420
|
+
}
|
|
27421
|
+
const destinationCaseError = bitcoinAddressCaseError(withdrawalAddress);
|
|
27422
|
+
if (destinationCaseError) {
|
|
27423
|
+
return { success: false, error: destinationCaseError };
|
|
27424
|
+
}
|
|
27425
|
+
withdrawalAddress = normalizeBitcoinAddress(withdrawalAddress);
|
|
26927
27426
|
const lockFailure = this.tryAcquireWriteLock(positionId);
|
|
26928
27427
|
if (lockFailure)
|
|
26929
27428
|
return lockFailure;
|
|
@@ -27437,7 +27936,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
27437
27936
|
*
|
|
27438
27937
|
* Deliberately omits `minWithdrawRatioBps` — see {@link readLoanGrant}.
|
|
27439
27938
|
*/
|
|
27440
|
-
static LOAN_GRANT_PREFIX_IFACE = new
|
|
27939
|
+
static LOAN_GRANT_PREFIX_IFACE = new import_ethers23.Interface([
|
|
27441
27940
|
"function getLoanGrant(bytes32 positionId) view returns (address borrower, uint32 scopeBits, uint32 minCollateralRatioBps)"
|
|
27442
27941
|
]);
|
|
27443
27942
|
/**
|
|
@@ -27458,9 +27957,9 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
27458
27957
|
to: registryAddress,
|
|
27459
27958
|
data: iface.encodeFunctionData("getLoanGrant", [pid])
|
|
27460
27959
|
});
|
|
27461
|
-
if ((0,
|
|
27960
|
+
if ((0, import_ethers23.getBytes)(data).length < 96) {
|
|
27462
27961
|
throw new SDKError({
|
|
27463
|
-
message: `AgentDelegationRegistry at ${registryAddress} returned ${(0,
|
|
27962
|
+
message: `AgentDelegationRegistry at ${registryAddress} returned ${(0, import_ethers23.getBytes)(data).length} bytes for getLoanGrant(bytes32) \u2014 expected at least 96. Wrong address, or a registry version this SDK does not support.`,
|
|
27464
27963
|
category: "CONTRACT" /* CONTRACT */,
|
|
27465
27964
|
severity: "HIGH" /* HIGH */
|
|
27466
27965
|
});
|
|
@@ -27469,10 +27968,10 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
27469
27968
|
"getLoanGrant",
|
|
27470
27969
|
data
|
|
27471
27970
|
);
|
|
27472
|
-
const raw = (0,
|
|
27971
|
+
const raw = (0, import_ethers23.getBytes)(data);
|
|
27473
27972
|
const withdrawScopeSupported = raw.length >= 128;
|
|
27474
27973
|
const minWithdrawRatioBps = withdrawScopeSupported ? Number(
|
|
27475
|
-
|
|
27974
|
+
import_ethers23.AbiCoder.defaultAbiCoder().decode(["uint32"], raw.slice(96, 128))[0]
|
|
27476
27975
|
) : 0;
|
|
27477
27976
|
return {
|
|
27478
27977
|
borrower,
|
|
@@ -27588,13 +28087,32 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
27588
28087
|
if (plan.kind === "reuse") {
|
|
27589
28088
|
agentAddress = plan.agent;
|
|
27590
28089
|
} else {
|
|
27591
|
-
|
|
28090
|
+
const minted = await mintAgentPkp({
|
|
27592
28091
|
serviceEndpoint: this.config.serviceEndpoint,
|
|
27593
28092
|
authHeader: this.serverSession ? () => this.serverSession.getAuthHeader() : void 0
|
|
27594
28093
|
});
|
|
28094
|
+
agentAddress = minted.walletAddress;
|
|
28095
|
+
const consentSigner = (0, import_ethers23.verifyTypedData)(
|
|
28096
|
+
{
|
|
28097
|
+
name: "DiamondHands.Protocol",
|
|
28098
|
+
version: "1",
|
|
28099
|
+
chainId: (await this.getProviderOrThrow().getNetwork()).chainId,
|
|
28100
|
+
verifyingContract: addr
|
|
28101
|
+
},
|
|
28102
|
+
AGENT_BINDING_CONSENT_TYPES,
|
|
28103
|
+
{ user, agent: agentAddress },
|
|
28104
|
+
minted.agentConsent
|
|
28105
|
+
);
|
|
28106
|
+
if ((0, import_ethers23.getAddress)(consentSigner) !== (0, import_ethers23.getAddress)(agentAddress)) {
|
|
28107
|
+
throw new SDKError({
|
|
28108
|
+
message: `Agent ${agentAddress}'s binding consent is not for ${user} on registry ${addr} \u2014 the lit-ops session must be signed in as the same wallet that binds the agent`,
|
|
28109
|
+
category: "AUTHORIZATION" /* AUTHORIZATION */,
|
|
28110
|
+
severity: "HIGH" /* HIGH */
|
|
28111
|
+
});
|
|
28112
|
+
}
|
|
27595
28113
|
const validitySeconds = options?.agentValiditySeconds ?? 90 * 24 * 60 * 60;
|
|
27596
28114
|
const validUntil = latestBlock.timestamp + validitySeconds;
|
|
27597
|
-
const bindTx = plan.kind === "rotate" ? await registry.rotateAgent(user, agentAddress, validUntil) : await registry.registerAgent(user, agentAddress, validUntil);
|
|
28115
|
+
const bindTx = plan.kind === "rotate" ? await registry.rotateAgent(user, agentAddress, validUntil, minted.agentConsent) : await registry.registerAgent(user, agentAddress, validUntil, minted.agentConsent);
|
|
27598
28116
|
await bindTx.wait();
|
|
27599
28117
|
}
|
|
27600
28118
|
const currentDelegate = await getPositionDelegate(pid, signer, pdrAddr).catch(
|
|
@@ -27634,7 +28152,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
27634
28152
|
getPositionDelegate(pid, signer, pdrAddr),
|
|
27635
28153
|
registry.agentOf(user).then((a) => a.agent)
|
|
27636
28154
|
]);
|
|
27637
|
-
if (currentDelegate !==
|
|
28155
|
+
if (currentDelegate !== import_ethers23.ZeroAddress && currentDelegate.toLowerCase() === userAgent.toLowerCase()) {
|
|
27638
28156
|
const clearTx = await setPositionDelegate(
|
|
27639
28157
|
pid,
|
|
27640
28158
|
"0x0000000000000000000000000000000000000000",
|
|
@@ -28026,7 +28544,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28026
28544
|
const maxUcdWhole = BigInt(result[3].toString());
|
|
28027
28545
|
return success({
|
|
28028
28546
|
liquidationThreshold: result[0].toString(),
|
|
28029
|
-
minimumLoanValueUcd: (0,
|
|
28547
|
+
minimumLoanValueUcd: (0, import_ethers23.formatUnits)(result[2], 18),
|
|
28030
28548
|
minimumLoanValueWei: result[2].toString(),
|
|
28031
28549
|
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
28032
28550
|
maxSingleLoanValueWei: (maxUcdWhole * 10n ** 18n).toString()
|
|
@@ -28063,7 +28581,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28063
28581
|
const balanceWei = await provider.getBalance(address);
|
|
28064
28582
|
return success({
|
|
28065
28583
|
balanceWei: balanceWei.toString(),
|
|
28066
|
-
balanceEth: (0,
|
|
28584
|
+
balanceEth: (0, import_ethers23.formatEther)(balanceWei)
|
|
28067
28585
|
});
|
|
28068
28586
|
} catch (error) {
|
|
28069
28587
|
return failure(new SDKError({
|
|
@@ -28472,7 +28990,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28472
28990
|
* Convert decimal position ID to bytes32 format
|
|
28473
28991
|
*/
|
|
28474
28992
|
toBytes32(value) {
|
|
28475
|
-
return (0,
|
|
28993
|
+
return (0, import_ethers23.zeroPadValue)((0, import_ethers23.toBeHex)(BigInt(value)), 32);
|
|
28476
28994
|
}
|
|
28477
28995
|
/**
|
|
28478
28996
|
* Check if an error indicates a technical failure vs business logic rejection
|
|
@@ -28513,7 +29031,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28513
29031
|
const coreModuleAbi = [
|
|
28514
29032
|
"function getPositionDetails(bytes32) view returns (tuple(bytes32 positionId, bytes32 pkpId, uint256 ucdDebt, string vaultAddress, address borrower, uint40 createdAt, uint40 lastUpdated, uint16 selectedTerm, uint40 expiryAt, uint8 status, uint40 previousExpiryAt, uint16 totalTerm))"
|
|
28515
29033
|
];
|
|
28516
|
-
const coreModule = new
|
|
29034
|
+
const coreModule = new import_ethers23.Contract(
|
|
28517
29035
|
coreModuleAddress,
|
|
28518
29036
|
coreModuleAbi,
|
|
28519
29037
|
provider
|
|
@@ -28580,7 +29098,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28580
29098
|
const corePositionAbi = [
|
|
28581
29099
|
"function getPositionDetails(bytes32) view returns (tuple(bytes32 positionId, bytes32 pkpId, uint256 ucdDebt, string vaultAddress, address borrower, uint40 createdAt, uint40 lastUpdated, uint16 selectedTerm, uint40 expiryAt, uint8 status, uint40 previousExpiryAt, uint16 totalTerm))"
|
|
28582
29100
|
];
|
|
28583
|
-
const corePositionContract = new
|
|
29101
|
+
const corePositionContract = new import_ethers23.Contract(
|
|
28584
29102
|
coreAddress,
|
|
28585
29103
|
corePositionAbi,
|
|
28586
29104
|
provider
|
|
@@ -28591,7 +29109,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28591
29109
|
positionIdBytes32
|
|
28592
29110
|
);
|
|
28593
29111
|
const positionIdFromCore = corePosition?.positionId || corePosition?.[0] || null;
|
|
28594
|
-
if (positionIdFromCore && positionIdFromCore !==
|
|
29112
|
+
if (positionIdFromCore && positionIdFromCore !== import_ethers23.ZeroHash && positionIdFromCore !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
28595
29113
|
if (this.config.debug) {
|
|
28596
29114
|
log.info("Position exists in core contract", {
|
|
28597
29115
|
positionId,
|
|
@@ -28659,7 +29177,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28659
29177
|
throw new Error("loanOperationsManager address not configured");
|
|
28660
29178
|
}
|
|
28661
29179
|
const runner = this.config.contractSigner || this.getProviderOrThrow();
|
|
28662
|
-
const contract = new
|
|
29180
|
+
const contract = new import_ethers23.Contract(
|
|
28663
29181
|
addr.loanOperationsManager,
|
|
28664
29182
|
[
|
|
28665
29183
|
"function getProtocolConfig() external view returns (uint256 liquidationThreshold, uint256 minimumLoanValueUcd, uint256 minimumLoanValueWei, uint256 maxSingleLoanValueUcd)"
|
|
@@ -28672,7 +29190,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28672
29190
|
const maxUcdWhole = BigInt(result[3].toString());
|
|
28673
29191
|
return {
|
|
28674
29192
|
liquidationThreshold: result[0].toString(),
|
|
28675
|
-
minimumLoanValueUcd: (0,
|
|
29193
|
+
minimumLoanValueUcd: (0, import_ethers23.formatUnits)(result[2], 18),
|
|
28676
29194
|
minimumLoanValueWei: result[2].toString(),
|
|
28677
29195
|
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
28678
29196
|
maxSingleLoanValueWei: (maxUcdWhole * 10n ** 18n).toString()
|
|
@@ -28690,8 +29208,8 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28690
29208
|
const MIN_REVEAL_DELAY = 60;
|
|
28691
29209
|
const MAX_RANDOM_DELAY = 240;
|
|
28692
29210
|
const entropyInput = positionId + quantumTimestamp.toString();
|
|
28693
|
-
const hash = (0,
|
|
28694
|
-
(0,
|
|
29211
|
+
const hash = (0, import_ethers23.keccak256)(
|
|
29212
|
+
(0, import_ethers23.toUtf8Bytes)(entropyInput)
|
|
28695
29213
|
);
|
|
28696
29214
|
const randomValue = BigInt(hash);
|
|
28697
29215
|
const randomDelay = Number(randomValue % BigInt(MAX_RANDOM_DELAY));
|
|
@@ -28716,12 +29234,12 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28716
29234
|
const rawPositionId = /^0x/i.test(params.positionId.trim()) ? params.positionId.trim().slice(2) : params.positionId.trim();
|
|
28717
29235
|
const canonicalPositionId = "0x" + rawPositionId.padStart(64, "0").toLowerCase();
|
|
28718
29236
|
const intentTimestamp = Math.floor(Date.now() / 1e3);
|
|
28719
|
-
const intentActionHash = (0,
|
|
28720
|
-
const intentHash = (0,
|
|
29237
|
+
const intentActionHash = (0, import_ethers23.keccak256)((0, import_ethers23.toUtf8Bytes)("liquidate-position"));
|
|
29238
|
+
const intentHash = (0, import_ethers23.solidityPackedKeccak256)(
|
|
28721
29239
|
["bytes32", "uint256", "uint256", "address", "bytes32"],
|
|
28722
29240
|
[canonicalPositionId, intentTimestamp, chainId, intentSigner, intentActionHash]
|
|
28723
29241
|
);
|
|
28724
|
-
const intentSignature = await signer.signMessage((0,
|
|
29242
|
+
const intentSignature = await signer.signMessage((0, import_ethers23.getBytes)(intentHash));
|
|
28725
29243
|
const response = await fetch(endpoint, {
|
|
28726
29244
|
method: "POST",
|
|
28727
29245
|
headers: { "Content-Type": "application/json" },
|
|
@@ -28773,7 +29291,7 @@ Message: ${causeMessage}${quantumContext}${loanCapDiagnostics}${mintDebtDiagnost
|
|
|
28773
29291
|
const vrfSeedRaw = await lmResult.value["vrfSeeds"](positionId);
|
|
28774
29292
|
const vrfSeed = BigInt(vrfSeedRaw.toString());
|
|
28775
29293
|
if (vrfSeed !== 0n) {
|
|
28776
|
-
const finalEntropy = (0,
|
|
29294
|
+
const finalEntropy = (0, import_ethers23.solidityPackedKeccak256)(
|
|
28777
29295
|
["uint256", "uint256", "bytes32"],
|
|
28778
29296
|
[vrfSeed, BigInt(quantumTimestamp.toString()), positionId]
|
|
28779
29297
|
);
|
|
@@ -29051,7 +29569,7 @@ var EventHelpers = {
|
|
|
29051
29569
|
};
|
|
29052
29570
|
|
|
29053
29571
|
// src/utils/safe-agent-delegation.utils.ts
|
|
29054
|
-
var
|
|
29572
|
+
var import_ethers24 = require("ethers");
|
|
29055
29573
|
init_deployment_addresses();
|
|
29056
29574
|
var SAFE_ABI = [
|
|
29057
29575
|
"function getModulesPaginated(address start, uint256 pageSize) view returns (address[] modules, address next)"
|
|
@@ -29069,7 +29587,7 @@ var MODULE_LIST_SENTINEL = "0x0000000000000000000000000000000000000001";
|
|
|
29069
29587
|
var MODULE_PAGE_SIZE = 50;
|
|
29070
29588
|
var lower = (v) => v.trim().toLowerCase();
|
|
29071
29589
|
async function classifyModule(provider, moduleAddress, safeAddress, positionManager, factoryAddress) {
|
|
29072
|
-
const module2 = new
|
|
29590
|
+
const module2 = new import_ethers24.Contract(moduleAddress, MODULE_ABI, provider);
|
|
29073
29591
|
let boundSafe;
|
|
29074
29592
|
try {
|
|
29075
29593
|
boundSafe = await module2.safe();
|
|
@@ -29089,7 +29607,7 @@ async function classifyModule(provider, moduleAddress, safeAddress, positionMana
|
|
|
29089
29607
|
if (!factoryAddress)
|
|
29090
29608
|
return null;
|
|
29091
29609
|
try {
|
|
29092
|
-
const factory = new
|
|
29610
|
+
const factory = new import_ethers24.Contract(factoryAddress, FACTORY_ABI, provider);
|
|
29093
29611
|
return await factory.isFromFactory(moduleAddress) === true;
|
|
29094
29612
|
} catch {
|
|
29095
29613
|
return null;
|
|
@@ -29118,7 +29636,7 @@ async function getSafeAgentDelegation(params) {
|
|
|
29118
29636
|
let modules;
|
|
29119
29637
|
let next;
|
|
29120
29638
|
try {
|
|
29121
|
-
const safe = new
|
|
29639
|
+
const safe = new import_ethers24.Contract(safeAddress, SAFE_ABI, provider);
|
|
29122
29640
|
const page = await safe.getModulesPaginated(
|
|
29123
29641
|
MODULE_LIST_SENTINEL,
|
|
29124
29642
|
MODULE_PAGE_SIZE
|
|
@@ -29146,7 +29664,7 @@ async function getSafeAgentDelegation(params) {
|
|
|
29146
29664
|
continue;
|
|
29147
29665
|
let agentAddress = null;
|
|
29148
29666
|
try {
|
|
29149
|
-
agentAddress = await new
|
|
29667
|
+
agentAddress = await new import_ethers24.Contract(
|
|
29150
29668
|
moduleAddress,
|
|
29151
29669
|
MODULE_ABI,
|
|
29152
29670
|
provider
|
|
@@ -29160,7 +29678,7 @@ async function getSafeAgentDelegation(params) {
|
|
|
29160
29678
|
let validUntil;
|
|
29161
29679
|
let status;
|
|
29162
29680
|
try {
|
|
29163
|
-
const record = await new
|
|
29681
|
+
const record = await new import_ethers24.Contract(
|
|
29164
29682
|
registryAddress,
|
|
29165
29683
|
REGISTRY_ABI,
|
|
29166
29684
|
provider
|
|
@@ -29195,6 +29713,11 @@ async function getSafeAgentDelegation(params) {
|
|
|
29195
29713
|
ALL_DEPLOYMENTS,
|
|
29196
29714
|
AuthParamsValidation,
|
|
29197
29715
|
BPSConversions,
|
|
29716
|
+
BTC_SPEND_QUANTUM_SECONDS,
|
|
29717
|
+
BTC_SPEND_RELAY_DEADLINE_SECONDS,
|
|
29718
|
+
BTC_SPEND_REQUEST_712_DOMAIN_NAME,
|
|
29719
|
+
BTC_SPEND_REQUEST_712_DOMAIN_VERSION,
|
|
29720
|
+
BTC_SPEND_REQUEST_712_FIELDS,
|
|
29198
29721
|
BitcoinOperations,
|
|
29199
29722
|
CacheManager,
|
|
29200
29723
|
ContractManager,
|
|
@@ -29228,9 +29751,15 @@ async function getSafeAgentDelegation(params) {
|
|
|
29228
29751
|
andThen,
|
|
29229
29752
|
assertProtocolNotPaused,
|
|
29230
29753
|
assertSafeServiceEndpoint,
|
|
29754
|
+
btcSpendAuthorizerAddress,
|
|
29755
|
+
btcSpendRequest712Digest,
|
|
29756
|
+
btcSpendRequest712Types,
|
|
29231
29757
|
buildBtcExecuteEnvelope,
|
|
29758
|
+
buildBtcSpendRequest712Domain,
|
|
29759
|
+
buildExecuteBtcWithdrawalTypedData,
|
|
29232
29760
|
buildInvalidateMessageHash,
|
|
29233
29761
|
buildInvalidateStaleSpendEnvelope,
|
|
29762
|
+
buildInvalidateStaleSpendTypedData,
|
|
29234
29763
|
buildLoginDomain,
|
|
29235
29764
|
buildSignedLoginPayload,
|
|
29236
29765
|
collectFailures,
|
|
@@ -29271,8 +29800,10 @@ async function getSafeAgentDelegation(params) {
|
|
|
29271
29800
|
mapError,
|
|
29272
29801
|
match,
|
|
29273
29802
|
numericToPositionStatus,
|
|
29803
|
+
readAuthorizedSpend,
|
|
29274
29804
|
reconcileAuthorizedSpend,
|
|
29275
29805
|
setPositionDelegate,
|
|
29806
|
+
signBtcSpendRequest712,
|
|
29276
29807
|
success,
|
|
29277
29808
|
toPromise,
|
|
29278
29809
|
tryCatch,
|