@gvnrdao/dh-sdk 0.0.312 → 0.0.313
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/constants/chunks/deployment-addresses.d.ts +4 -0
- package/dist/constants/chunks/network-configs.d.ts +2 -0
- package/dist/contracts/typechain-contracts/factories/src/agent/AgentDelegationRegistry__factory.d.ts +1324 -0
- package/dist/contracts/typechain-contracts/src/agent/AgentDelegationRegistry.d.ts +995 -0
- package/dist/deployments.js +14 -7
- package/dist/deployments.mjs +14 -7
- package/dist/index.js +2345 -357
- package/dist/index.mjs +2318 -326
- package/dist/interfaces/chunks/config.i.d.ts +4 -0
- package/dist/modules/diamond-hands-sdk.d.ts +36 -0
- package/dist/modules/loan/loan-creator.module.d.ts +26 -0
- package/dist/utils/agent-delegation.utils.d.ts +20 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -88,13 +88,15 @@ var init_deployment_addresses = __esm({
|
|
|
88
88
|
PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9",
|
|
89
89
|
FeeRecipientRegistry: "0x95795F8403DDb629E8527B2934C4e71f5fC0C374",
|
|
90
90
|
BitcoinWithdrawalAddressRegistry: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
|
|
91
|
-
CarryAgentRegistry: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7"
|
|
91
|
+
CarryAgentRegistry: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7",
|
|
92
|
+
AgentDelegationRegistry: "0xA6040Ee7c52220634C6cC565885d6956C95Faaf5",
|
|
93
|
+
DHAgentDelegate: "0x3Ea189b22Db147A7c79fF3FD8AaDfA8B0Bd0f4FB"
|
|
92
94
|
},
|
|
93
95
|
upgraded: {
|
|
94
96
|
PositionManager: {
|
|
95
|
-
previousImplementation: "
|
|
96
|
-
newImplementation: "
|
|
97
|
-
upgradedAt: "2026-07-
|
|
97
|
+
previousImplementation: "0x3a493909920DF104D4048c2c20270B9DAFC81716",
|
|
98
|
+
newImplementation: "0x607a80aee6eF425C7eC7bA5230E5FAFC95B0388F",
|
|
99
|
+
upgradedAt: "2026-07-23T23:55:25.994Z",
|
|
98
100
|
upgradedBy: "0xF20986F02420EF443AE9BE5092FB8A4975cF3aA6",
|
|
99
101
|
reason: "Shared upgrade script: PositionManager implementation update"
|
|
100
102
|
},
|
|
@@ -321,7 +323,7 @@ var init_deployment_addresses = __esm({
|
|
|
321
323
|
CIRCUIT_BREAKER_MODULE_IMPL: "0xF6277dEF72D51312CC99616B5380f34Eb7603D75",
|
|
322
324
|
ADMIN_MODULE_IMPL: "0xBBA86246169f81a307Fafff02C1e3D8456aab973",
|
|
323
325
|
POSITION_MANAGER_VIEWS_IMPL: "0xA455B542cFb36AF8451fc420dB89e590E5c87cef",
|
|
324
|
-
POSITION_MANAGER_IMPL: "
|
|
326
|
+
POSITION_MANAGER_IMPL: "0x607a80aee6eF425C7eC7bA5230E5FAFC95B0388F",
|
|
325
327
|
SIMPLE_PSM_V2: "0x19EcF7BA26e054fd4Ff06009A03070103dbBB058",
|
|
326
328
|
SIMPLE_PSM_V2_IMPL: "0xE38010BE47B389922A1cd4b533470F0af7d20101",
|
|
327
329
|
UCD_TOKEN_IMPL: "0xa6C8C4cfc7DD3dCE5F1259A4a1eAf8461aA8CeC8",
|
|
@@ -352,7 +354,10 @@ var init_deployment_addresses = __esm({
|
|
|
352
354
|
BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
|
|
353
355
|
BITCOIN_WITHDRAWAL_ADDRESS_REGISTRY_IMPL: "0xFF270BC4470dBA80430Bd1a3a66EB691599354fA",
|
|
354
356
|
CARRY_AGENT_REGISTRY: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7",
|
|
355
|
-
CARRY_AGENT_REGISTRY_IMPL: "0x1b11a3D5e46F3672E643c997f0d569DFf0b64a01"
|
|
357
|
+
CARRY_AGENT_REGISTRY_IMPL: "0x1b11a3D5e46F3672E643c997f0d569DFf0b64a01",
|
|
358
|
+
AGENT_DELEGATION_REGISTRY: "0xA6040Ee7c52220634C6cC565885d6956C95Faaf5",
|
|
359
|
+
AGENT_DELEGATION_REGISTRY_IMPL: "0x4cCB77306A1EE0F1F686EeF83B66eD8796E6dd90",
|
|
360
|
+
DH_AGENT_DELEGATE: "0x3Ea189b22Db147A7c79fF3FD8AaDfA8B0Bd0f4FB"
|
|
356
361
|
}
|
|
357
362
|
};
|
|
358
363
|
SEPOLIA_CONTRACTS = {
|
|
@@ -381,7 +386,9 @@ var init_deployment_addresses = __esm({
|
|
|
381
386
|
PositionDelegateRegistry: "0x482369De283622E7b05731875ec137d4E3D208F9",
|
|
382
387
|
FeeRecipientRegistry: "0x95795F8403DDb629E8527B2934C4e71f5fC0C374",
|
|
383
388
|
BitcoinWithdrawalAddressRegistry: "0x6376D392097F0A81e51BD83960A97EA20eaf1dbe",
|
|
384
|
-
CarryAgentRegistry: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7"
|
|
389
|
+
CarryAgentRegistry: "0x5595CB538D44E6Cf179D20364fD631D0477e69f7",
|
|
390
|
+
AgentDelegationRegistry: "0xA6040Ee7c52220634C6cC565885d6956C95Faaf5",
|
|
391
|
+
DHAgentDelegate: "0x3Ea189b22Db147A7c79fF3FD8AaDfA8B0Bd0f4FB"
|
|
385
392
|
};
|
|
386
393
|
MAINNET_DEPLOYMENT = {
|
|
387
394
|
network: "mainnet",
|
|
@@ -1303,30 +1310,30 @@ var require_pkg_src = __commonJS({
|
|
|
1303
1310
|
}
|
|
1304
1311
|
},
|
|
1305
1312
|
btcTransactionSigner: {
|
|
1306
|
-
cid: "
|
|
1313
|
+
cid: "QmZFzjpdwpiBxHPv3t1mhjv8hfPRD1hPZGJ7jUU9w6V2Ca",
|
|
1307
1314
|
authorizedCidHex: cidToHex(
|
|
1308
|
-
"
|
|
1315
|
+
"QmZFzjpdwpiBxHPv3t1mhjv8hfPRD1hPZGJ7jUU9w6V2Ca"
|
|
1309
1316
|
),
|
|
1310
1317
|
name: "Btc Transaction Signer",
|
|
1311
1318
|
description: "Production Btc Transaction Signer",
|
|
1312
1319
|
version: "1.1.1",
|
|
1313
1320
|
deployed: true,
|
|
1314
|
-
deployedAt:
|
|
1315
|
-
size:
|
|
1316
|
-
hash: "
|
|
1321
|
+
deployedAt: 1785173232972,
|
|
1322
|
+
size: 66562,
|
|
1323
|
+
hash: "13639ec13bfed381c3c9d81e17e37917446ba30d04d4d8e45809a6868139c3cb"
|
|
1317
1324
|
},
|
|
1318
1325
|
ucdMintValidator: {
|
|
1319
|
-
cid: "
|
|
1326
|
+
cid: "Qmb1TPCaNYRTHsnhZrE1J4BtVYNWBnWSneXRqyAco1XKku",
|
|
1320
1327
|
authorizedCidHex: cidToHex(
|
|
1321
|
-
"
|
|
1328
|
+
"Qmb1TPCaNYRTHsnhZrE1J4BtVYNWBnWSneXRqyAco1XKku"
|
|
1322
1329
|
),
|
|
1323
1330
|
name: "Ucd Mint Validator",
|
|
1324
1331
|
description: "Production Ucd Mint Validator",
|
|
1325
1332
|
version: "1.2.1",
|
|
1326
1333
|
deployed: true,
|
|
1327
|
-
deployedAt:
|
|
1328
|
-
size:
|
|
1329
|
-
hash: "
|
|
1334
|
+
deployedAt: 1785173240530,
|
|
1335
|
+
size: 81596,
|
|
1336
|
+
hash: "fdaa7abb4ad28ae1f20f5cd6e3e03e5a8787fd6ac05938f51070ed16844f80f5",
|
|
1330
1337
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1331
1338
|
pkp: {
|
|
1332
1339
|
publicKey: "0x041ab17cd91fc5c0b761eea6092d032807561b621b82c488826776e04a9158d61ba64d809a4729f0501289d980732cb06d8dfd06999dd9c8efd2f495dad78b31bb",
|
|
@@ -1334,17 +1341,17 @@ var require_pkg_src = __commonJS({
|
|
|
1334
1341
|
}
|
|
1335
1342
|
},
|
|
1336
1343
|
processPaymentValidator: {
|
|
1337
|
-
cid: "
|
|
1344
|
+
cid: "QmWSSAgmLtfVsRawHU2Uf72Xw4hM5T5Jcx2n7EVmEHQD1E",
|
|
1338
1345
|
authorizedCidHex: cidToHex(
|
|
1339
|
-
"
|
|
1346
|
+
"QmWSSAgmLtfVsRawHU2Uf72Xw4hM5T5Jcx2n7EVmEHQD1E"
|
|
1340
1347
|
),
|
|
1341
1348
|
name: "Process Payment Validator",
|
|
1342
1349
|
description: "Production Process Payment Validator",
|
|
1343
1350
|
version: "1.2.1",
|
|
1344
1351
|
deployed: true,
|
|
1345
|
-
deployedAt:
|
|
1346
|
-
size:
|
|
1347
|
-
hash: "
|
|
1352
|
+
deployedAt: 1785173245463,
|
|
1353
|
+
size: 77593,
|
|
1354
|
+
hash: "0f1015e51702abd9834e295ea12ac8dbd906909d25f72ad6a509c061e625c75d",
|
|
1348
1355
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1349
1356
|
pkp: {
|
|
1350
1357
|
publicKey: "0x04cfccb9b6c7addc79469c0e9fafebef4c70801302c62cdb26b610723a9b8527d23f98a40158c7340d83fd0e62d02b5ec74c12f7a86d98e8c6973b4811110f19ad",
|
|
@@ -1352,17 +1359,17 @@ var require_pkg_src = __commonJS({
|
|
|
1352
1359
|
}
|
|
1353
1360
|
},
|
|
1354
1361
|
extendPositionValidator: {
|
|
1355
|
-
cid: "
|
|
1362
|
+
cid: "QmZyx9qUVyWu7deCJFLZxB1WDVRBgobs1Vm6m4ECGMbpkS",
|
|
1356
1363
|
authorizedCidHex: cidToHex(
|
|
1357
|
-
"
|
|
1364
|
+
"QmZyx9qUVyWu7deCJFLZxB1WDVRBgobs1Vm6m4ECGMbpkS"
|
|
1358
1365
|
),
|
|
1359
1366
|
name: "Extend Position Validator",
|
|
1360
1367
|
description: "Production Extend Position Validator",
|
|
1361
1368
|
version: "1.2.1",
|
|
1362
1369
|
deployed: true,
|
|
1363
|
-
deployedAt:
|
|
1364
|
-
size:
|
|
1365
|
-
hash: "
|
|
1370
|
+
deployedAt: 1785173255906,
|
|
1371
|
+
size: 75372,
|
|
1372
|
+
hash: "545dc96a7e9b4d0aaadf239127b804a92df60b6b5b2fbb3203ef7de9ad97980a",
|
|
1366
1373
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1367
1374
|
pkp: {
|
|
1368
1375
|
publicKey: "0x04e52338f6a0c3362800f1a94c4c8f08be5030dde0fa217388c53d1c1a4790f4443c9f2886b2d2d8f4b75a9a156e9b028011b1a1cf7648da0e556aa980ec692836",
|
|
@@ -1370,17 +1377,17 @@ var require_pkg_src = __commonJS({
|
|
|
1370
1377
|
}
|
|
1371
1378
|
},
|
|
1372
1379
|
btcWithdrawal: {
|
|
1373
|
-
cid: "
|
|
1380
|
+
cid: "QmXKsozVz832mvU5xgvFnAAms1kfQrHAKj1areHfkDkoK7",
|
|
1374
1381
|
authorizedCidHex: cidToHex(
|
|
1375
|
-
"
|
|
1382
|
+
"QmXKsozVz832mvU5xgvFnAAms1kfQrHAKj1areHfkDkoK7"
|
|
1376
1383
|
),
|
|
1377
1384
|
name: "Btc Withdrawal",
|
|
1378
1385
|
description: "Production Btc Withdrawal",
|
|
1379
|
-
version: "1.2.
|
|
1386
|
+
version: "1.2.1",
|
|
1380
1387
|
deployed: true,
|
|
1381
|
-
deployedAt:
|
|
1382
|
-
size:
|
|
1383
|
-
hash: "
|
|
1388
|
+
deployedAt: 1785173260209,
|
|
1389
|
+
size: 92692,
|
|
1390
|
+
hash: "18ade8e4f0c79896eee613d16c86de135f1d3daaa0fa056bcdbcaa0dff793c77",
|
|
1384
1391
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1385
1392
|
pkp: {
|
|
1386
1393
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
@@ -1388,17 +1395,17 @@ var require_pkg_src = __commonJS({
|
|
|
1388
1395
|
}
|
|
1389
1396
|
},
|
|
1390
1397
|
liquidationValidator: {
|
|
1391
|
-
cid: "
|
|
1398
|
+
cid: "Qme6aGADhiszkQbZL977E6nmBacd2PEB7K9Hs8puVrscNx",
|
|
1392
1399
|
authorizedCidHex: cidToHex(
|
|
1393
|
-
"
|
|
1400
|
+
"Qme6aGADhiszkQbZL977E6nmBacd2PEB7K9Hs8puVrscNx"
|
|
1394
1401
|
),
|
|
1395
1402
|
name: "Liquidation Validator",
|
|
1396
1403
|
description: "Production Liquidation Validator",
|
|
1397
1404
|
version: "1.2.1",
|
|
1398
1405
|
deployed: true,
|
|
1399
|
-
deployedAt:
|
|
1400
|
-
size:
|
|
1401
|
-
hash: "
|
|
1406
|
+
deployedAt: 1785173262533,
|
|
1407
|
+
size: 66846,
|
|
1408
|
+
hash: "b35ee7706d733d625faa4dbe37f73c8e20f0c1befa897cd7875e827de52003de",
|
|
1402
1409
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1403
1410
|
pkp: {
|
|
1404
1411
|
publicKey: "0x041a241de58976c13e3d7ca5a18e494f7330151e3818706135d50176e78ffb673e58b11f0b67a87c73fade6c6b27d6e7a7377ea9f4c10bf31880f1d725f18cc6f8",
|
|
@@ -1424,17 +1431,17 @@ var require_pkg_src = __commonJS({
|
|
|
1424
1431
|
}
|
|
1425
1432
|
},
|
|
1426
1433
|
loanVaultBtcBalance: {
|
|
1427
|
-
cid: "
|
|
1434
|
+
cid: "QmaeQoHYvcMYobNbu9hQavGDudi8AXoW9tg3YHrvy1g2A4",
|
|
1428
1435
|
authorizedCidHex: cidToHex(
|
|
1429
|
-
"
|
|
1436
|
+
"QmaeQoHYvcMYobNbu9hQavGDudi8AXoW9tg3YHrvy1g2A4"
|
|
1430
1437
|
),
|
|
1431
1438
|
name: "Loan Vault Btc Balance",
|
|
1432
1439
|
description: "Production Loan Vault Btc Balance",
|
|
1433
1440
|
version: "1.2.1",
|
|
1434
1441
|
deployed: true,
|
|
1435
|
-
deployedAt:
|
|
1436
|
-
size:
|
|
1437
|
-
hash: "
|
|
1442
|
+
deployedAt: 1785173271802,
|
|
1443
|
+
size: 56800,
|
|
1444
|
+
hash: "a059133214e6ba0a73d655a15600c4b33e361fb340c98f8eecaf8ab7b95aaf83",
|
|
1438
1445
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1439
1446
|
pkp: {
|
|
1440
1447
|
publicKey: "0x043616787c5432415c24378c4ef48de2bcd6bb7b575b837e3cff09171802662da7105d79586c7659677a0ecbaddac4cce06cb2a11f69a16fa0c4d7002ac7d51a4d",
|
|
@@ -1448,17 +1455,17 @@ var require_pkg_src = __commonJS({
|
|
|
1448
1455
|
// Requires BitcoinProviderRegistry.addAllowedCid(chainId, keccak256(utf8(cid)))
|
|
1449
1456
|
// on each target chain (the action decrypts registry slots). No OAR entry.
|
|
1450
1457
|
btcAddressBalance: {
|
|
1451
|
-
cid: "
|
|
1458
|
+
cid: "QmUXUtU9r1HhQVYgkXPN5s19SKXanhn4pMsCtFEP3GK4Kj",
|
|
1452
1459
|
authorizedCidHex: cidToHex(
|
|
1453
|
-
"
|
|
1460
|
+
"QmUXUtU9r1HhQVYgkXPN5s19SKXanhn4pMsCtFEP3GK4Kj"
|
|
1454
1461
|
),
|
|
1455
1462
|
name: "Btc Address Balance",
|
|
1456
1463
|
description: "Address-only signed total BTC balance via registry consensus (no positionId, no price)",
|
|
1457
1464
|
version: "0.2.1",
|
|
1458
1465
|
deployed: true,
|
|
1459
|
-
deployedAt:
|
|
1460
|
-
size:
|
|
1461
|
-
hash: "
|
|
1466
|
+
deployedAt: 1785173280221,
|
|
1467
|
+
size: 27309,
|
|
1468
|
+
hash: "f0d08938713d9d89a56a3a386cacbc2b57afd5ad367ea82d827d40e1bfc70989",
|
|
1462
1469
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1463
1470
|
pkp: {
|
|
1464
1471
|
publicKey: "0x0498cbb31facfa26e3ec83ccdabfe4fe341ca0282e0c3cb81da7113723b9726e1e49efa92165cc3faa66ced4454cea56dbab12267852d6525a55d7c4f128b912cd",
|
|
@@ -1492,17 +1499,17 @@ var require_pkg_src = __commonJS({
|
|
|
1492
1499
|
hash: "03ee5be239c91c735d2c95db89a0d1b77e602cfc18af8eb64b3281fddcd90a72"
|
|
1493
1500
|
},
|
|
1494
1501
|
staleSpendRecoveryValidator: {
|
|
1495
|
-
cid: "
|
|
1502
|
+
cid: "QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm",
|
|
1496
1503
|
authorizedCidHex: cidToHex(
|
|
1497
|
-
"
|
|
1504
|
+
"QmXQWT8V4wjuvH8BbC7xrkYxsVu5AKfvfWcS7jnYfrexYm"
|
|
1498
1505
|
),
|
|
1499
1506
|
name: "Stale Spend Recovery Validator",
|
|
1500
1507
|
description: "Production Stale Spend Recovery Validator",
|
|
1501
1508
|
version: "1.1.2",
|
|
1502
1509
|
deployed: true,
|
|
1503
|
-
deployedAt:
|
|
1504
|
-
size:
|
|
1505
|
-
hash: "
|
|
1510
|
+
deployedAt: 1785173285829,
|
|
1511
|
+
size: 37108,
|
|
1512
|
+
hash: "04de5fc5b6f5131dc1544e3d3d187a1f9ef9616ffd12483d119f9102b3671791",
|
|
1506
1513
|
validatorWalletAddress: "0x82DB9F515957aA380B596C6eA2Bd30CEF181f236",
|
|
1507
1514
|
pkp: {
|
|
1508
1515
|
publicKey: "0x046da0ad6da7dd4a0063cbeac6f2bdb6a9889c2178b23470833356a8ee5630f7f0eee0db348d9d9aaaadd23eccf0063c8f68ee5e446abe30b882bf1de4c932bc21",
|
|
@@ -1510,17 +1517,17 @@ var require_pkg_src = __commonJS({
|
|
|
1510
1517
|
}
|
|
1511
1518
|
},
|
|
1512
1519
|
btcUtxoInvalidator: {
|
|
1513
|
-
cid: "
|
|
1520
|
+
cid: "Qmc9W2dgGpRax5Q2nXw8ciGF9RHjWj1y9v2MMWNbrCwnZb",
|
|
1514
1521
|
authorizedCidHex: cidToHex(
|
|
1515
|
-
"
|
|
1522
|
+
"Qmc9W2dgGpRax5Q2nXw8ciGF9RHjWj1y9v2MMWNbrCwnZb"
|
|
1516
1523
|
),
|
|
1517
1524
|
name: "Btc Utxo Invalidator",
|
|
1518
1525
|
description: "Production Btc Utxo Invalidator",
|
|
1519
1526
|
version: "1.0.0",
|
|
1520
1527
|
deployed: true,
|
|
1521
|
-
deployedAt:
|
|
1522
|
-
size:
|
|
1523
|
-
hash: "
|
|
1528
|
+
deployedAt: 1785173292828,
|
|
1529
|
+
size: 61410,
|
|
1530
|
+
hash: "9ca3817ea626b4ebca184e20cae827a8a982f48d6cd1497e81bb4469aa282627"
|
|
1524
1531
|
}
|
|
1525
1532
|
};
|
|
1526
1533
|
function getDeploymentsForNetwork(network) {
|
|
@@ -2266,7 +2273,7 @@ ${errorReport}`);
|
|
|
2266
2273
|
}
|
|
2267
2274
|
init_debug_logger();
|
|
2268
2275
|
init_session_signature_cache();
|
|
2269
|
-
var
|
|
2276
|
+
var import_ethers18 = require("ethers");
|
|
2270
2277
|
var EXPIRED_LOAN_MIN_LIQUIDATION_THRESHOLD_BPS = 11e3;
|
|
2271
2278
|
var GRACE_PERIOD_DAYS = 30;
|
|
2272
2279
|
var SATOSHIS_PER_BITCOIN = 100000000n;
|
|
@@ -5040,6 +5047,7 @@ ${auth.clientId}`;
|
|
|
5040
5047
|
],
|
|
5041
5048
|
allowArbitraryBitcoinProvider: true,
|
|
5042
5049
|
allowArbitraryEvmRpc: true,
|
|
5050
|
+
pinContractAddresses: false,
|
|
5043
5051
|
allowDevSinglePriceProvider: true,
|
|
5044
5052
|
minBitcoinBalanceConfirmations: 1,
|
|
5045
5053
|
minBitcoinSpendConfirmations: 1,
|
|
@@ -5060,6 +5068,7 @@ ${auth.clientId}`;
|
|
|
5060
5068
|
],
|
|
5061
5069
|
allowArbitraryBitcoinProvider: false,
|
|
5062
5070
|
allowArbitraryEvmRpc: false,
|
|
5071
|
+
pinContractAddresses: true,
|
|
5063
5072
|
allowDevSinglePriceProvider: false,
|
|
5064
5073
|
minBitcoinBalanceConfirmations: 1,
|
|
5065
5074
|
minBitcoinSpendConfirmations: 1,
|
|
@@ -5080,6 +5089,7 @@ ${auth.clientId}`;
|
|
|
5080
5089
|
],
|
|
5081
5090
|
allowArbitraryBitcoinProvider: false,
|
|
5082
5091
|
allowArbitraryEvmRpc: false,
|
|
5092
|
+
pinContractAddresses: true,
|
|
5083
5093
|
allowDevSinglePriceProvider: false,
|
|
5084
5094
|
minBitcoinBalanceConfirmations: 6,
|
|
5085
5095
|
minBitcoinSpendConfirmations: 6,
|
|
@@ -5096,12 +5106,12 @@ ${auth.clientId}`;
|
|
|
5096
5106
|
}
|
|
5097
5107
|
async function executeVaultSnapshot(params) {
|
|
5098
5108
|
global.ethers = {
|
|
5099
|
-
...
|
|
5109
|
+
...import_ethers18.ethers,
|
|
5100
5110
|
providers: {
|
|
5101
|
-
StaticJsonRpcProvider:
|
|
5111
|
+
StaticJsonRpcProvider: import_ethers18.ethers.JsonRpcProvider
|
|
5102
5112
|
},
|
|
5103
|
-
Contract:
|
|
5104
|
-
utils:
|
|
5113
|
+
Contract: import_ethers18.ethers.Contract,
|
|
5114
|
+
utils: import_ethers18.ethers
|
|
5105
5115
|
// v6 moved utils to top level
|
|
5106
5116
|
};
|
|
5107
5117
|
global.Lit = {
|
|
@@ -5373,7 +5383,9 @@ function getSepoliaConfig() {
|
|
|
5373
5383
|
feeRecipientRegistry: SEPOLIA_CONTRACTS.FeeRecipientRegistry || "",
|
|
5374
5384
|
positionDelegateRegistry: SEPOLIA_CONTRACTS.PositionDelegateRegistry || "",
|
|
5375
5385
|
bitcoinWithdrawalAddressRegistry: SEPOLIA_CONTRACTS.BitcoinWithdrawalAddressRegistry || "",
|
|
5376
|
-
carryAgentRegistry: SEPOLIA_CONTRACTS.CarryAgentRegistry || ""
|
|
5386
|
+
carryAgentRegistry: SEPOLIA_CONTRACTS.CarryAgentRegistry || "",
|
|
5387
|
+
agentDelegationRegistry: SEPOLIA_CONTRACTS.AgentDelegationRegistry || "",
|
|
5388
|
+
dhAgentDelegate: SEPOLIA_CONTRACTS.DHAgentDelegate || ""
|
|
5377
5389
|
},
|
|
5378
5390
|
subgraphs: {
|
|
5379
5391
|
// Lazy getter for the same module-init snapshot reason as serviceEndpoint.
|
|
@@ -5414,7 +5426,9 @@ function getMainnetConfig() {
|
|
|
5414
5426
|
feeRecipientRegistry: MAINNET_CONTRACTS.FeeRecipientRegistry || "",
|
|
5415
5427
|
positionDelegateRegistry: MAINNET_CONTRACTS.PositionDelegateRegistry || "",
|
|
5416
5428
|
bitcoinWithdrawalAddressRegistry: MAINNET_CONTRACTS.BitcoinWithdrawalAddressRegistry || "",
|
|
5417
|
-
carryAgentRegistry: MAINNET_CONTRACTS.CarryAgentRegistry || ""
|
|
5429
|
+
carryAgentRegistry: MAINNET_CONTRACTS.CarryAgentRegistry || "",
|
|
5430
|
+
agentDelegationRegistry: MAINNET_CONTRACTS.AgentDelegationRegistry || "",
|
|
5431
|
+
dhAgentDelegate: MAINNET_CONTRACTS.DHAgentDelegate || ""
|
|
5418
5432
|
},
|
|
5419
5433
|
subgraphs: {
|
|
5420
5434
|
diamondHandsUrl: "https://gateway-arbitrum.network.thegraph.com/api/subgraphs/id/CCTPsdYqco2jChDLLBQTbdJWwoukVoMt1cXeR9ti6r9A"
|
|
@@ -5650,7 +5664,7 @@ __export(src_exports, {
|
|
|
5650
5664
|
module.exports = __toCommonJS(src_exports);
|
|
5651
5665
|
|
|
5652
5666
|
// src/modules/diamond-hands-sdk.ts
|
|
5653
|
-
var
|
|
5667
|
+
var import_ethers17 = require("ethers");
|
|
5654
5668
|
|
|
5655
5669
|
// src/types/result.ts
|
|
5656
5670
|
function success(value) {
|
|
@@ -9425,7 +9439,14 @@ var LoanCreator = class {
|
|
|
9425
9439
|
if (!positionIdResult.success) {
|
|
9426
9440
|
return failure(positionIdResult.error);
|
|
9427
9441
|
}
|
|
9428
|
-
const
|
|
9442
|
+
const confirmedIdResult = await this.confirmPositionId(
|
|
9443
|
+
receipt,
|
|
9444
|
+
positionIdResult.value
|
|
9445
|
+
);
|
|
9446
|
+
if (!confirmedIdResult.success) {
|
|
9447
|
+
return failure(confirmedIdResult.error);
|
|
9448
|
+
}
|
|
9449
|
+
const positionId = confirmedIdResult.value;
|
|
9429
9450
|
const result = {
|
|
9430
9451
|
success: true,
|
|
9431
9452
|
transactionHash: receipt.hash,
|
|
@@ -9576,8 +9597,9 @@ var LoanCreator = class {
|
|
|
9576
9597
|
hash: tx.hash
|
|
9577
9598
|
});
|
|
9578
9599
|
}
|
|
9600
|
+
const confirmations = await this.createPositionConfirmations();
|
|
9579
9601
|
const receipt = await Promise.race([
|
|
9580
|
-
tx.wait(
|
|
9602
|
+
tx.wait(confirmations),
|
|
9581
9603
|
new Promise(
|
|
9582
9604
|
(_, reject) => setTimeout(
|
|
9583
9605
|
() => reject(new Error("Transaction confirmation timeout")),
|
|
@@ -9699,6 +9721,88 @@ var LoanCreator = class {
|
|
|
9699
9721
|
);
|
|
9700
9722
|
}
|
|
9701
9723
|
}
|
|
9724
|
+
/**
|
|
9725
|
+
* Confirmation depth to wait for before trusting `positionId` from a receipt.
|
|
9726
|
+
*
|
|
9727
|
+
* Deeper is safer but slower, so local chains (instant mining, no reorgs) stay at 1.
|
|
9728
|
+
* Override with `createPositionConfirmations` when a chain needs more.
|
|
9729
|
+
*/
|
|
9730
|
+
async createPositionConfirmations() {
|
|
9731
|
+
const configured = this.config.createPositionConfirmations;
|
|
9732
|
+
if (typeof configured === "number" && configured >= 1)
|
|
9733
|
+
return configured;
|
|
9734
|
+
try {
|
|
9735
|
+
const network = await this.config.contractManager.getProvider().getNetwork();
|
|
9736
|
+
const chainId = Number(network.chainId);
|
|
9737
|
+
if (chainId === 31337 || chainId === 1337)
|
|
9738
|
+
return 1;
|
|
9739
|
+
} catch {
|
|
9740
|
+
}
|
|
9741
|
+
return 3;
|
|
9742
|
+
}
|
|
9743
|
+
/**
|
|
9744
|
+
* Re-read the receipt after confirmations and re-derive `positionId`, so a reorg
|
|
9745
|
+
* cannot leave the caller holding an id that never survived to the canonical chain.
|
|
9746
|
+
*
|
|
9747
|
+
* Returns the authoritative id. If the re-read disagrees with what was first
|
|
9748
|
+
* extracted, the fresh value wins and the divergence is logged loudly — silently
|
|
9749
|
+
* returning a phantom id is how this surfaced as a `PositionNotFound()` hundreds of
|
|
9750
|
+
* lines downstream, long after the real cause.
|
|
9751
|
+
*/
|
|
9752
|
+
async confirmPositionId(receipt, extractedId) {
|
|
9753
|
+
let authoritativeId = extractedId;
|
|
9754
|
+
try {
|
|
9755
|
+
const provider = this.config.contractManager.getProvider();
|
|
9756
|
+
const fresh = await provider.getTransactionReceipt(receipt.hash);
|
|
9757
|
+
if (!fresh) {
|
|
9758
|
+
return failure(
|
|
9759
|
+
new SDKError({
|
|
9760
|
+
message: `Loan creation receipt ${receipt.hash} is no longer on-chain after confirmation (dropped or reorged). The position, if any, must be rediscovered before use.`,
|
|
9761
|
+
category: "CONTRACT" /* CONTRACT */,
|
|
9762
|
+
severity: "HIGH" /* HIGH */,
|
|
9763
|
+
originalError: new Error("Receipt vanished after confirmation")
|
|
9764
|
+
})
|
|
9765
|
+
);
|
|
9766
|
+
}
|
|
9767
|
+
const reExtracted = this.extractPositionId(
|
|
9768
|
+
fresh
|
|
9769
|
+
);
|
|
9770
|
+
if (reExtracted.success && reExtracted.value !== extractedId) {
|
|
9771
|
+
log.warn(
|
|
9772
|
+
"\u26A0\uFE0F positionId changed after confirmation \u2014 the block was reorged and the transaction re-executed with a different block.timestamp/positionCounter. Using the canonical value.",
|
|
9773
|
+
{ transactionHash: receipt.hash, before: extractedId, after: reExtracted.value }
|
|
9774
|
+
);
|
|
9775
|
+
authoritativeId = reExtracted.value;
|
|
9776
|
+
}
|
|
9777
|
+
} catch (e) {
|
|
9778
|
+
log.warn("Could not re-read loan creation receipt for confirmation", {
|
|
9779
|
+
error: e?.message ?? String(e)
|
|
9780
|
+
});
|
|
9781
|
+
}
|
|
9782
|
+
const coreAddress = this.config.contractManager.getContractAddresses().positionManagerCore;
|
|
9783
|
+
if (coreAddress) {
|
|
9784
|
+
try {
|
|
9785
|
+
const core = new import_ethers11.Contract(
|
|
9786
|
+
coreAddress,
|
|
9787
|
+
[
|
|
9788
|
+
"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))"
|
|
9789
|
+
],
|
|
9790
|
+
this.config.contractManager.getProvider()
|
|
9791
|
+
);
|
|
9792
|
+
await core.getFunction("getPositionDetails")(authoritativeId);
|
|
9793
|
+
} catch {
|
|
9794
|
+
return failure(
|
|
9795
|
+
new SDKError({
|
|
9796
|
+
message: `Loan creation reported positionId ${authoritativeId}, but no such position exists on-chain (tx ${receipt.hash}). This usually means the block was reorged after the receipt was read. Retry loan creation; do not use this id.`,
|
|
9797
|
+
category: "CONTRACT" /* CONTRACT */,
|
|
9798
|
+
severity: "HIGH" /* HIGH */,
|
|
9799
|
+
originalError: new Error("positionId not found on-chain after creation")
|
|
9800
|
+
})
|
|
9801
|
+
);
|
|
9802
|
+
}
|
|
9803
|
+
}
|
|
9804
|
+
return success(authoritativeId);
|
|
9805
|
+
}
|
|
9702
9806
|
/**
|
|
9703
9807
|
* Extract position ID from transaction receipt
|
|
9704
9808
|
*/
|
|
@@ -16112,201 +16216,1976 @@ var SimplePSMV2__factory = class extends import_ethers14.ContractFactory {
|
|
|
16112
16216
|
}
|
|
16113
16217
|
};
|
|
16114
16218
|
|
|
16115
|
-
// src/
|
|
16116
|
-
var
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
if (this.config.debug) {
|
|
16135
|
-
log.info("\u{1FA99} Minting mock BTC", {
|
|
16136
|
-
amount: amount.toString(),
|
|
16137
|
-
recipient
|
|
16138
|
-
});
|
|
16139
|
-
}
|
|
16140
|
-
if (this.isProductionNetwork()) {
|
|
16141
|
-
return failure(
|
|
16142
|
-
new SDKError({
|
|
16143
|
-
message: "Cannot mint mock tokens on production network",
|
|
16144
|
-
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
16145
|
-
severity: "HIGH" /* HIGH */,
|
|
16146
|
-
originalError: new Error("Production network detected")
|
|
16147
|
-
})
|
|
16148
|
-
);
|
|
16149
|
-
}
|
|
16150
|
-
return tryCatchAsync(
|
|
16151
|
-
async () => {
|
|
16152
|
-
const signerResult = this.config.contractManager.getSigner();
|
|
16153
|
-
if (!signerResult.success) {
|
|
16154
|
-
throw signerResult.error;
|
|
16155
|
-
}
|
|
16156
|
-
throw new Error("Mock BTC contract not yet integrated");
|
|
16157
|
-
},
|
|
16158
|
-
(error) => new SDKError({
|
|
16159
|
-
message: "Failed to mint mock BTC",
|
|
16160
|
-
category: "CONTRACT" /* CONTRACT */,
|
|
16161
|
-
severity: "MEDIUM" /* MEDIUM */,
|
|
16162
|
-
originalError: error instanceof Error ? error : new Error(String(error)),
|
|
16163
|
-
context: { amount: amount.toString(), recipient }
|
|
16164
|
-
})
|
|
16165
|
-
);
|
|
16166
|
-
}
|
|
16167
|
-
/**
|
|
16168
|
-
* Approve mock BTC spending
|
|
16169
|
-
*
|
|
16170
|
-
* @param spender - Spender address
|
|
16171
|
-
* @param amount - Amount to approve in satoshis
|
|
16172
|
-
* @returns Transaction result
|
|
16173
|
-
*/
|
|
16174
|
-
async approveMockBTC(spender, amount) {
|
|
16175
|
-
if (this.config.debug) {
|
|
16176
|
-
log.info("\u2705 Approving mock BTC spending", {
|
|
16177
|
-
spender,
|
|
16178
|
-
amount: amount.toString()
|
|
16179
|
-
});
|
|
16180
|
-
}
|
|
16181
|
-
if (this.isProductionNetwork()) {
|
|
16182
|
-
return failure(
|
|
16183
|
-
new SDKError({
|
|
16184
|
-
message: "Cannot approve mock tokens on production network",
|
|
16185
|
-
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
16186
|
-
severity: "HIGH" /* HIGH */,
|
|
16187
|
-
originalError: new Error("Production network detected")
|
|
16188
|
-
})
|
|
16189
|
-
);
|
|
16190
|
-
}
|
|
16191
|
-
return tryCatchAsync(
|
|
16192
|
-
async () => {
|
|
16193
|
-
const signerResult = this.config.contractManager.getSigner();
|
|
16194
|
-
if (!signerResult.success) {
|
|
16195
|
-
throw signerResult.error;
|
|
16196
|
-
}
|
|
16197
|
-
throw new Error("Mock BTC contract not yet integrated");
|
|
16198
|
-
},
|
|
16199
|
-
(error) => new SDKError({
|
|
16200
|
-
message: "Failed to approve mock BTC",
|
|
16201
|
-
category: "CONTRACT" /* CONTRACT */,
|
|
16202
|
-
severity: "MEDIUM" /* MEDIUM */,
|
|
16203
|
-
originalError: error instanceof Error ? error : new Error(String(error)),
|
|
16204
|
-
context: { spender, amount: amount.toString() }
|
|
16205
|
-
})
|
|
16206
|
-
);
|
|
16207
|
-
}
|
|
16208
|
-
/**
|
|
16209
|
-
* Get mock BTC balance
|
|
16210
|
-
*
|
|
16211
|
-
* @param address - Address to query
|
|
16212
|
-
* @returns Balance in satoshis
|
|
16213
|
-
*/
|
|
16214
|
-
async getMockBTCBalance(address) {
|
|
16215
|
-
if (this.config.debug) {
|
|
16216
|
-
log.info("\u{1F50D} Querying mock BTC balance", { address });
|
|
16217
|
-
}
|
|
16218
|
-
return tryCatchAsync(
|
|
16219
|
-
async () => {
|
|
16220
|
-
throw new Error("Mock BTC contract not yet integrated");
|
|
16219
|
+
// src/contracts/typechain-contracts/factories/src/agent/AgentDelegationRegistry__factory.ts
|
|
16220
|
+
var import_ethers15 = require("ethers");
|
|
16221
|
+
var _abi2 = [
|
|
16222
|
+
{
|
|
16223
|
+
inputs: [],
|
|
16224
|
+
stateMutability: "nonpayable",
|
|
16225
|
+
type: "constructor"
|
|
16226
|
+
},
|
|
16227
|
+
{
|
|
16228
|
+
inputs: [],
|
|
16229
|
+
name: "AccessControlBadConfirmation",
|
|
16230
|
+
type: "error"
|
|
16231
|
+
},
|
|
16232
|
+
{
|
|
16233
|
+
inputs: [
|
|
16234
|
+
{
|
|
16235
|
+
internalType: "address",
|
|
16236
|
+
name: "account",
|
|
16237
|
+
type: "address"
|
|
16221
16238
|
},
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
}
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
}
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
}
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
}
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16274
|
-
|
|
16275
|
-
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
|
|
16292
|
-
}
|
|
16293
|
-
|
|
16294
|
-
|
|
16295
|
-
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16301
|
-
|
|
16302
|
-
|
|
16303
|
-
|
|
16304
|
-
|
|
16305
|
-
|
|
16306
|
-
|
|
16307
|
-
|
|
16308
|
-
|
|
16309
|
-
|
|
16239
|
+
{
|
|
16240
|
+
internalType: "bytes32",
|
|
16241
|
+
name: "neededRole",
|
|
16242
|
+
type: "bytes32"
|
|
16243
|
+
}
|
|
16244
|
+
],
|
|
16245
|
+
name: "AccessControlUnauthorizedAccount",
|
|
16246
|
+
type: "error"
|
|
16247
|
+
},
|
|
16248
|
+
{
|
|
16249
|
+
inputs: [
|
|
16250
|
+
{
|
|
16251
|
+
internalType: "address",
|
|
16252
|
+
name: "target",
|
|
16253
|
+
type: "address"
|
|
16254
|
+
}
|
|
16255
|
+
],
|
|
16256
|
+
name: "AddressEmptyCode",
|
|
16257
|
+
type: "error"
|
|
16258
|
+
},
|
|
16259
|
+
{
|
|
16260
|
+
inputs: [],
|
|
16261
|
+
name: "AgentAddressReused",
|
|
16262
|
+
type: "error"
|
|
16263
|
+
},
|
|
16264
|
+
{
|
|
16265
|
+
inputs: [],
|
|
16266
|
+
name: "AgentIsActiveUseRotate",
|
|
16267
|
+
type: "error"
|
|
16268
|
+
},
|
|
16269
|
+
{
|
|
16270
|
+
inputs: [],
|
|
16271
|
+
name: "AgentNotActive",
|
|
16272
|
+
type: "error"
|
|
16273
|
+
},
|
|
16274
|
+
{
|
|
16275
|
+
inputs: [],
|
|
16276
|
+
name: "CannotUpgradeToSelf",
|
|
16277
|
+
type: "error"
|
|
16278
|
+
},
|
|
16279
|
+
{
|
|
16280
|
+
inputs: [
|
|
16281
|
+
{
|
|
16282
|
+
internalType: "address",
|
|
16283
|
+
name: "implementation",
|
|
16284
|
+
type: "address"
|
|
16285
|
+
}
|
|
16286
|
+
],
|
|
16287
|
+
name: "ERC1967InvalidImplementation",
|
|
16288
|
+
type: "error"
|
|
16289
|
+
},
|
|
16290
|
+
{
|
|
16291
|
+
inputs: [],
|
|
16292
|
+
name: "ERC1967NonPayable",
|
|
16293
|
+
type: "error"
|
|
16294
|
+
},
|
|
16295
|
+
{
|
|
16296
|
+
inputs: [],
|
|
16297
|
+
name: "EnforcedPause",
|
|
16298
|
+
type: "error"
|
|
16299
|
+
},
|
|
16300
|
+
{
|
|
16301
|
+
inputs: [],
|
|
16302
|
+
name: "ExceedsMaxTtl",
|
|
16303
|
+
type: "error"
|
|
16304
|
+
},
|
|
16305
|
+
{
|
|
16306
|
+
inputs: [],
|
|
16307
|
+
name: "ExpectedPause",
|
|
16308
|
+
type: "error"
|
|
16309
|
+
},
|
|
16310
|
+
{
|
|
16311
|
+
inputs: [],
|
|
16312
|
+
name: "FailedCall",
|
|
16313
|
+
type: "error"
|
|
16314
|
+
},
|
|
16315
|
+
{
|
|
16316
|
+
inputs: [],
|
|
16317
|
+
name: "FloorBelowProtocolMin",
|
|
16318
|
+
type: "error"
|
|
16319
|
+
},
|
|
16320
|
+
{
|
|
16321
|
+
inputs: [],
|
|
16322
|
+
name: "ImplementationNotDeployed",
|
|
16323
|
+
type: "error"
|
|
16324
|
+
},
|
|
16325
|
+
{
|
|
16326
|
+
inputs: [],
|
|
16327
|
+
name: "InvalidAddress",
|
|
16328
|
+
type: "error"
|
|
16329
|
+
},
|
|
16330
|
+
{
|
|
16331
|
+
inputs: [],
|
|
16332
|
+
name: "InvalidFloor",
|
|
16333
|
+
type: "error"
|
|
16334
|
+
},
|
|
16335
|
+
{
|
|
16336
|
+
inputs: [],
|
|
16337
|
+
name: "InvalidInitialization",
|
|
16338
|
+
type: "error"
|
|
16339
|
+
},
|
|
16340
|
+
{
|
|
16341
|
+
inputs: [],
|
|
16342
|
+
name: "InvalidPositionId",
|
|
16343
|
+
type: "error"
|
|
16344
|
+
},
|
|
16345
|
+
{
|
|
16346
|
+
inputs: [],
|
|
16347
|
+
name: "NoActiveAgent",
|
|
16348
|
+
type: "error"
|
|
16349
|
+
},
|
|
16350
|
+
{
|
|
16351
|
+
inputs: [],
|
|
16352
|
+
name: "NotAdminModule",
|
|
16353
|
+
type: "error"
|
|
16354
|
+
},
|
|
16355
|
+
{
|
|
16356
|
+
inputs: [],
|
|
16357
|
+
name: "NotAuthorizedConsumer",
|
|
16358
|
+
type: "error"
|
|
16359
|
+
},
|
|
16360
|
+
{
|
|
16361
|
+
inputs: [],
|
|
16362
|
+
name: "NotBorrowerOrRegistrar",
|
|
16363
|
+
type: "error"
|
|
16364
|
+
},
|
|
16365
|
+
{
|
|
16366
|
+
inputs: [],
|
|
16367
|
+
name: "NotContract",
|
|
16368
|
+
type: "error"
|
|
16369
|
+
},
|
|
16370
|
+
{
|
|
16371
|
+
inputs: [],
|
|
16372
|
+
name: "NotInitializing",
|
|
16373
|
+
type: "error"
|
|
16374
|
+
},
|
|
16375
|
+
{
|
|
16376
|
+
inputs: [],
|
|
16377
|
+
name: "NotUserOrRegistrar",
|
|
16378
|
+
type: "error"
|
|
16379
|
+
},
|
|
16380
|
+
{
|
|
16381
|
+
inputs: [],
|
|
16382
|
+
name: "PositionNotActive",
|
|
16383
|
+
type: "error"
|
|
16384
|
+
},
|
|
16385
|
+
{
|
|
16386
|
+
inputs: [],
|
|
16387
|
+
name: "PositionNotDelegable",
|
|
16388
|
+
type: "error"
|
|
16389
|
+
},
|
|
16390
|
+
{
|
|
16391
|
+
inputs: [],
|
|
16392
|
+
name: "RenewalCapReached",
|
|
16393
|
+
type: "error"
|
|
16394
|
+
},
|
|
16395
|
+
{
|
|
16396
|
+
inputs: [],
|
|
16397
|
+
name: "ScopeNotGranted",
|
|
16398
|
+
type: "error"
|
|
16399
|
+
},
|
|
16400
|
+
{
|
|
16401
|
+
inputs: [],
|
|
16402
|
+
name: "UUPSUnauthorizedCallContext",
|
|
16403
|
+
type: "error"
|
|
16404
|
+
},
|
|
16405
|
+
{
|
|
16406
|
+
inputs: [
|
|
16407
|
+
{
|
|
16408
|
+
internalType: "bytes32",
|
|
16409
|
+
name: "slot",
|
|
16410
|
+
type: "bytes32"
|
|
16411
|
+
}
|
|
16412
|
+
],
|
|
16413
|
+
name: "UUPSUnsupportedProxiableUUID",
|
|
16414
|
+
type: "error"
|
|
16415
|
+
},
|
|
16416
|
+
{
|
|
16417
|
+
inputs: [],
|
|
16418
|
+
name: "UnauthorizedUnpause",
|
|
16419
|
+
type: "error"
|
|
16420
|
+
},
|
|
16421
|
+
{
|
|
16422
|
+
inputs: [],
|
|
16423
|
+
name: "UnexpectedRoleGrantFailure",
|
|
16424
|
+
type: "error"
|
|
16425
|
+
},
|
|
16426
|
+
{
|
|
16427
|
+
inputs: [],
|
|
16428
|
+
name: "ValidUntilInPast",
|
|
16429
|
+
type: "error"
|
|
16430
|
+
},
|
|
16431
|
+
{
|
|
16432
|
+
anonymous: false,
|
|
16433
|
+
inputs: [
|
|
16434
|
+
{
|
|
16435
|
+
indexed: true,
|
|
16436
|
+
internalType: "address",
|
|
16437
|
+
name: "oldAdminModule",
|
|
16438
|
+
type: "address"
|
|
16439
|
+
},
|
|
16440
|
+
{
|
|
16441
|
+
indexed: true,
|
|
16442
|
+
internalType: "address",
|
|
16443
|
+
name: "newAdminModule",
|
|
16444
|
+
type: "address"
|
|
16445
|
+
}
|
|
16446
|
+
],
|
|
16447
|
+
name: "AdminModuleUpdated",
|
|
16448
|
+
type: "event"
|
|
16449
|
+
},
|
|
16450
|
+
{
|
|
16451
|
+
anonymous: false,
|
|
16452
|
+
inputs: [
|
|
16453
|
+
{
|
|
16454
|
+
indexed: false,
|
|
16455
|
+
internalType: "uint32",
|
|
16456
|
+
name: "oldBps",
|
|
16457
|
+
type: "uint32"
|
|
16458
|
+
},
|
|
16459
|
+
{
|
|
16460
|
+
indexed: false,
|
|
16461
|
+
internalType: "uint32",
|
|
16462
|
+
name: "newBps",
|
|
16463
|
+
type: "uint32"
|
|
16464
|
+
}
|
|
16465
|
+
],
|
|
16466
|
+
name: "AgentMintFloorMinUpdated",
|
|
16467
|
+
type: "event"
|
|
16468
|
+
},
|
|
16469
|
+
{
|
|
16470
|
+
anonymous: false,
|
|
16471
|
+
inputs: [
|
|
16472
|
+
{
|
|
16473
|
+
indexed: true,
|
|
16474
|
+
internalType: "address",
|
|
16475
|
+
name: "user",
|
|
16476
|
+
type: "address"
|
|
16477
|
+
},
|
|
16478
|
+
{
|
|
16479
|
+
indexed: true,
|
|
16480
|
+
internalType: "address",
|
|
16481
|
+
name: "agent",
|
|
16482
|
+
type: "address"
|
|
16483
|
+
},
|
|
16484
|
+
{
|
|
16485
|
+
indexed: false,
|
|
16486
|
+
internalType: "uint64",
|
|
16487
|
+
name: "validUntil",
|
|
16488
|
+
type: "uint64"
|
|
16489
|
+
}
|
|
16490
|
+
],
|
|
16491
|
+
name: "AgentRegistered",
|
|
16492
|
+
type: "event"
|
|
16493
|
+
},
|
|
16494
|
+
{
|
|
16495
|
+
anonymous: false,
|
|
16496
|
+
inputs: [
|
|
16497
|
+
{
|
|
16498
|
+
indexed: true,
|
|
16499
|
+
internalType: "address",
|
|
16500
|
+
name: "user",
|
|
16501
|
+
type: "address"
|
|
16502
|
+
},
|
|
16503
|
+
{
|
|
16504
|
+
indexed: true,
|
|
16505
|
+
internalType: "address",
|
|
16506
|
+
name: "agent",
|
|
16507
|
+
type: "address"
|
|
16508
|
+
},
|
|
16509
|
+
{
|
|
16510
|
+
indexed: false,
|
|
16511
|
+
internalType: "bytes32",
|
|
16512
|
+
name: "reason",
|
|
16513
|
+
type: "bytes32"
|
|
16514
|
+
}
|
|
16515
|
+
],
|
|
16516
|
+
name: "AgentRevoked",
|
|
16517
|
+
type: "event"
|
|
16518
|
+
},
|
|
16519
|
+
{
|
|
16520
|
+
anonymous: false,
|
|
16521
|
+
inputs: [
|
|
16522
|
+
{
|
|
16523
|
+
indexed: true,
|
|
16524
|
+
internalType: "address",
|
|
16525
|
+
name: "user",
|
|
16526
|
+
type: "address"
|
|
16527
|
+
},
|
|
16528
|
+
{
|
|
16529
|
+
indexed: true,
|
|
16530
|
+
internalType: "address",
|
|
16531
|
+
name: "oldAgent",
|
|
16532
|
+
type: "address"
|
|
16533
|
+
},
|
|
16534
|
+
{
|
|
16535
|
+
indexed: true,
|
|
16536
|
+
internalType: "address",
|
|
16537
|
+
name: "newAgent",
|
|
16538
|
+
type: "address"
|
|
16539
|
+
},
|
|
16540
|
+
{
|
|
16541
|
+
indexed: false,
|
|
16542
|
+
internalType: "uint64",
|
|
16543
|
+
name: "validUntil",
|
|
16544
|
+
type: "uint64"
|
|
16545
|
+
}
|
|
16546
|
+
],
|
|
16547
|
+
name: "AgentRotated",
|
|
16548
|
+
type: "event"
|
|
16549
|
+
},
|
|
16550
|
+
{
|
|
16551
|
+
anonymous: false,
|
|
16552
|
+
inputs: [
|
|
16553
|
+
{
|
|
16554
|
+
indexed: true,
|
|
16555
|
+
internalType: "address",
|
|
16556
|
+
name: "previous",
|
|
16557
|
+
type: "address"
|
|
16558
|
+
},
|
|
16559
|
+
{
|
|
16560
|
+
indexed: true,
|
|
16561
|
+
internalType: "address",
|
|
16562
|
+
name: "next",
|
|
16563
|
+
type: "address"
|
|
16564
|
+
}
|
|
16565
|
+
],
|
|
16566
|
+
name: "AuthorizedConsumerUpdated",
|
|
16567
|
+
type: "event"
|
|
16568
|
+
},
|
|
16569
|
+
{
|
|
16570
|
+
anonymous: false,
|
|
16571
|
+
inputs: [
|
|
16572
|
+
{
|
|
16573
|
+
indexed: true,
|
|
16574
|
+
internalType: "bytes32",
|
|
16575
|
+
name: "positionId",
|
|
16576
|
+
type: "bytes32"
|
|
16577
|
+
},
|
|
16578
|
+
{
|
|
16579
|
+
indexed: true,
|
|
16580
|
+
internalType: "address",
|
|
16581
|
+
name: "borrower",
|
|
16582
|
+
type: "address"
|
|
16583
|
+
}
|
|
16584
|
+
],
|
|
16585
|
+
name: "AutoMintDisabled",
|
|
16586
|
+
type: "event"
|
|
16587
|
+
},
|
|
16588
|
+
{
|
|
16589
|
+
anonymous: false,
|
|
16590
|
+
inputs: [
|
|
16591
|
+
{
|
|
16592
|
+
indexed: true,
|
|
16593
|
+
internalType: "bytes32",
|
|
16594
|
+
name: "positionId",
|
|
16595
|
+
type: "bytes32"
|
|
16596
|
+
},
|
|
16597
|
+
{
|
|
16598
|
+
indexed: true,
|
|
16599
|
+
internalType: "address",
|
|
16600
|
+
name: "borrower",
|
|
16601
|
+
type: "address"
|
|
16602
|
+
},
|
|
16603
|
+
{
|
|
16604
|
+
indexed: false,
|
|
16605
|
+
internalType: "uint32",
|
|
16606
|
+
name: "minCollateralRatioBps",
|
|
16607
|
+
type: "uint32"
|
|
16608
|
+
}
|
|
16609
|
+
],
|
|
16610
|
+
name: "AutoMintEnabled",
|
|
16611
|
+
type: "event"
|
|
16612
|
+
},
|
|
16613
|
+
{
|
|
16614
|
+
anonymous: false,
|
|
16615
|
+
inputs: [
|
|
16616
|
+
{
|
|
16617
|
+
indexed: true,
|
|
16618
|
+
internalType: "bytes32",
|
|
16619
|
+
name: "positionId",
|
|
16620
|
+
type: "bytes32"
|
|
16621
|
+
},
|
|
16622
|
+
{
|
|
16623
|
+
indexed: true,
|
|
16624
|
+
internalType: "address",
|
|
16625
|
+
name: "borrower",
|
|
16626
|
+
type: "address"
|
|
16627
|
+
}
|
|
16628
|
+
],
|
|
16629
|
+
name: "AutoRenewDisabled",
|
|
16630
|
+
type: "event"
|
|
16631
|
+
},
|
|
16632
|
+
{
|
|
16633
|
+
anonymous: false,
|
|
16634
|
+
inputs: [
|
|
16635
|
+
{
|
|
16636
|
+
indexed: true,
|
|
16637
|
+
internalType: "bytes32",
|
|
16638
|
+
name: "positionId",
|
|
16639
|
+
type: "bytes32"
|
|
16640
|
+
},
|
|
16641
|
+
{
|
|
16642
|
+
indexed: true,
|
|
16643
|
+
internalType: "address",
|
|
16644
|
+
name: "borrower",
|
|
16645
|
+
type: "address"
|
|
16646
|
+
},
|
|
16647
|
+
{
|
|
16648
|
+
indexed: false,
|
|
16649
|
+
internalType: "uint32",
|
|
16650
|
+
name: "maxRenewals",
|
|
16651
|
+
type: "uint32"
|
|
16652
|
+
},
|
|
16653
|
+
{
|
|
16654
|
+
indexed: false,
|
|
16655
|
+
internalType: "uint40",
|
|
16656
|
+
name: "maxEndTimestamp",
|
|
16657
|
+
type: "uint40"
|
|
16658
|
+
}
|
|
16659
|
+
],
|
|
16660
|
+
name: "AutoRenewEnabled",
|
|
16661
|
+
type: "event"
|
|
16662
|
+
},
|
|
16663
|
+
{
|
|
16664
|
+
anonymous: false,
|
|
16665
|
+
inputs: [
|
|
16666
|
+
{
|
|
16667
|
+
indexed: true,
|
|
16668
|
+
internalType: "bytes32",
|
|
16669
|
+
name: "positionId",
|
|
16670
|
+
type: "bytes32"
|
|
16671
|
+
},
|
|
16672
|
+
{
|
|
16673
|
+
indexed: true,
|
|
16674
|
+
internalType: "address",
|
|
16675
|
+
name: "borrower",
|
|
16676
|
+
type: "address"
|
|
16677
|
+
}
|
|
16678
|
+
],
|
|
16679
|
+
name: "AutoRepayDisabled",
|
|
16680
|
+
type: "event"
|
|
16681
|
+
},
|
|
16682
|
+
{
|
|
16683
|
+
anonymous: false,
|
|
16684
|
+
inputs: [
|
|
16685
|
+
{
|
|
16686
|
+
indexed: true,
|
|
16687
|
+
internalType: "bytes32",
|
|
16688
|
+
name: "positionId",
|
|
16689
|
+
type: "bytes32"
|
|
16690
|
+
},
|
|
16691
|
+
{
|
|
16692
|
+
indexed: true,
|
|
16693
|
+
internalType: "address",
|
|
16694
|
+
name: "borrower",
|
|
16695
|
+
type: "address"
|
|
16696
|
+
}
|
|
16697
|
+
],
|
|
16698
|
+
name: "AutoRepayEnabled",
|
|
16699
|
+
type: "event"
|
|
16700
|
+
},
|
|
16701
|
+
{
|
|
16702
|
+
anonymous: false,
|
|
16703
|
+
inputs: [
|
|
16704
|
+
{
|
|
16705
|
+
indexed: true,
|
|
16706
|
+
internalType: "address",
|
|
16707
|
+
name: "caller",
|
|
16708
|
+
type: "address"
|
|
16709
|
+
},
|
|
16710
|
+
{
|
|
16711
|
+
indexed: false,
|
|
16712
|
+
internalType: "uint256",
|
|
16713
|
+
name: "timestamp",
|
|
16714
|
+
type: "uint256"
|
|
16715
|
+
}
|
|
16716
|
+
],
|
|
16717
|
+
name: "ContractPaused",
|
|
16718
|
+
type: "event"
|
|
16719
|
+
},
|
|
16720
|
+
{
|
|
16721
|
+
anonymous: false,
|
|
16722
|
+
inputs: [
|
|
16723
|
+
{
|
|
16724
|
+
indexed: true,
|
|
16725
|
+
internalType: "address",
|
|
16726
|
+
name: "caller",
|
|
16727
|
+
type: "address"
|
|
16728
|
+
},
|
|
16729
|
+
{
|
|
16730
|
+
indexed: false,
|
|
16731
|
+
internalType: "uint256",
|
|
16732
|
+
name: "timestamp",
|
|
16733
|
+
type: "uint256"
|
|
16734
|
+
}
|
|
16735
|
+
],
|
|
16736
|
+
name: "ContractUnpaused",
|
|
16737
|
+
type: "event"
|
|
16738
|
+
},
|
|
16739
|
+
{
|
|
16740
|
+
anonymous: false,
|
|
16741
|
+
inputs: [
|
|
16742
|
+
{
|
|
16743
|
+
indexed: true,
|
|
16744
|
+
internalType: "address",
|
|
16745
|
+
name: "oldImplementation",
|
|
16746
|
+
type: "address"
|
|
16747
|
+
},
|
|
16748
|
+
{
|
|
16749
|
+
indexed: true,
|
|
16750
|
+
internalType: "address",
|
|
16751
|
+
name: "newImplementation",
|
|
16752
|
+
type: "address"
|
|
16753
|
+
},
|
|
16754
|
+
{
|
|
16755
|
+
indexed: false,
|
|
16756
|
+
internalType: "string",
|
|
16757
|
+
name: "version",
|
|
16758
|
+
type: "string"
|
|
16759
|
+
},
|
|
16760
|
+
{
|
|
16761
|
+
indexed: false,
|
|
16762
|
+
internalType: "uint256",
|
|
16763
|
+
name: "timestamp",
|
|
16764
|
+
type: "uint256"
|
|
16765
|
+
}
|
|
16766
|
+
],
|
|
16767
|
+
name: "ContractUpgraded",
|
|
16768
|
+
type: "event"
|
|
16769
|
+
},
|
|
16770
|
+
{
|
|
16771
|
+
anonymous: false,
|
|
16772
|
+
inputs: [
|
|
16773
|
+
{
|
|
16774
|
+
indexed: false,
|
|
16775
|
+
internalType: "uint64",
|
|
16776
|
+
name: "version",
|
|
16777
|
+
type: "uint64"
|
|
16778
|
+
}
|
|
16779
|
+
],
|
|
16780
|
+
name: "Initialized",
|
|
16781
|
+
type: "event"
|
|
16782
|
+
},
|
|
16783
|
+
{
|
|
16784
|
+
anonymous: false,
|
|
16785
|
+
inputs: [
|
|
16786
|
+
{
|
|
16787
|
+
indexed: false,
|
|
16788
|
+
internalType: "uint64",
|
|
16789
|
+
name: "oldTtl",
|
|
16790
|
+
type: "uint64"
|
|
16791
|
+
},
|
|
16792
|
+
{
|
|
16793
|
+
indexed: false,
|
|
16794
|
+
internalType: "uint64",
|
|
16795
|
+
name: "newTtl",
|
|
16796
|
+
type: "uint64"
|
|
16797
|
+
}
|
|
16798
|
+
],
|
|
16799
|
+
name: "MaxAgentTtlUpdated",
|
|
16800
|
+
type: "event"
|
|
16801
|
+
},
|
|
16802
|
+
{
|
|
16803
|
+
anonymous: false,
|
|
16804
|
+
inputs: [
|
|
16805
|
+
{
|
|
16806
|
+
indexed: true,
|
|
16807
|
+
internalType: "bytes32",
|
|
16808
|
+
name: "positionId",
|
|
16809
|
+
type: "bytes32"
|
|
16810
|
+
},
|
|
16811
|
+
{
|
|
16812
|
+
indexed: false,
|
|
16813
|
+
internalType: "uint32",
|
|
16814
|
+
name: "oldFloorBps",
|
|
16815
|
+
type: "uint32"
|
|
16816
|
+
},
|
|
16817
|
+
{
|
|
16818
|
+
indexed: false,
|
|
16819
|
+
internalType: "uint32",
|
|
16820
|
+
name: "newFloorBps",
|
|
16821
|
+
type: "uint32"
|
|
16822
|
+
}
|
|
16823
|
+
],
|
|
16824
|
+
name: "MintCollateralFloorUpdated",
|
|
16825
|
+
type: "event"
|
|
16826
|
+
},
|
|
16827
|
+
{
|
|
16828
|
+
anonymous: false,
|
|
16829
|
+
inputs: [
|
|
16830
|
+
{
|
|
16831
|
+
indexed: false,
|
|
16832
|
+
internalType: "address",
|
|
16833
|
+
name: "account",
|
|
16834
|
+
type: "address"
|
|
16835
|
+
}
|
|
16836
|
+
],
|
|
16837
|
+
name: "Paused",
|
|
16838
|
+
type: "event"
|
|
16839
|
+
},
|
|
16840
|
+
{
|
|
16841
|
+
anonymous: false,
|
|
16842
|
+
inputs: [
|
|
16843
|
+
{
|
|
16844
|
+
indexed: true,
|
|
16845
|
+
internalType: "bytes32",
|
|
16846
|
+
name: "positionId",
|
|
16847
|
+
type: "bytes32"
|
|
16848
|
+
},
|
|
16849
|
+
{
|
|
16850
|
+
indexed: false,
|
|
16851
|
+
internalType: "uint32",
|
|
16852
|
+
name: "renewalsUsed",
|
|
16853
|
+
type: "uint32"
|
|
16854
|
+
}
|
|
16855
|
+
],
|
|
16856
|
+
name: "RenewalRecorded",
|
|
16857
|
+
type: "event"
|
|
16858
|
+
},
|
|
16859
|
+
{
|
|
16860
|
+
anonymous: false,
|
|
16861
|
+
inputs: [
|
|
16862
|
+
{
|
|
16863
|
+
indexed: true,
|
|
16864
|
+
internalType: "bytes32",
|
|
16865
|
+
name: "role",
|
|
16866
|
+
type: "bytes32"
|
|
16867
|
+
},
|
|
16868
|
+
{
|
|
16869
|
+
indexed: true,
|
|
16870
|
+
internalType: "bytes32",
|
|
16871
|
+
name: "previousAdminRole",
|
|
16872
|
+
type: "bytes32"
|
|
16873
|
+
},
|
|
16874
|
+
{
|
|
16875
|
+
indexed: true,
|
|
16876
|
+
internalType: "bytes32",
|
|
16877
|
+
name: "newAdminRole",
|
|
16878
|
+
type: "bytes32"
|
|
16879
|
+
}
|
|
16880
|
+
],
|
|
16881
|
+
name: "RoleAdminChanged",
|
|
16882
|
+
type: "event"
|
|
16883
|
+
},
|
|
16884
|
+
{
|
|
16885
|
+
anonymous: false,
|
|
16886
|
+
inputs: [
|
|
16887
|
+
{
|
|
16888
|
+
indexed: true,
|
|
16889
|
+
internalType: "bytes32",
|
|
16890
|
+
name: "role",
|
|
16891
|
+
type: "bytes32"
|
|
16892
|
+
},
|
|
16893
|
+
{
|
|
16894
|
+
indexed: true,
|
|
16895
|
+
internalType: "address",
|
|
16896
|
+
name: "account",
|
|
16897
|
+
type: "address"
|
|
16898
|
+
},
|
|
16899
|
+
{
|
|
16900
|
+
indexed: true,
|
|
16901
|
+
internalType: "address",
|
|
16902
|
+
name: "sender",
|
|
16903
|
+
type: "address"
|
|
16904
|
+
}
|
|
16905
|
+
],
|
|
16906
|
+
name: "RoleGranted",
|
|
16907
|
+
type: "event"
|
|
16908
|
+
},
|
|
16909
|
+
{
|
|
16910
|
+
anonymous: false,
|
|
16911
|
+
inputs: [
|
|
16912
|
+
{
|
|
16913
|
+
indexed: true,
|
|
16914
|
+
internalType: "bytes32",
|
|
16915
|
+
name: "role",
|
|
16916
|
+
type: "bytes32"
|
|
16917
|
+
},
|
|
16918
|
+
{
|
|
16919
|
+
indexed: true,
|
|
16920
|
+
internalType: "address",
|
|
16921
|
+
name: "account",
|
|
16922
|
+
type: "address"
|
|
16923
|
+
},
|
|
16924
|
+
{
|
|
16925
|
+
indexed: true,
|
|
16926
|
+
internalType: "address",
|
|
16927
|
+
name: "sender",
|
|
16928
|
+
type: "address"
|
|
16929
|
+
}
|
|
16930
|
+
],
|
|
16931
|
+
name: "RoleRevoked",
|
|
16932
|
+
type: "event"
|
|
16933
|
+
},
|
|
16934
|
+
{
|
|
16935
|
+
anonymous: false,
|
|
16936
|
+
inputs: [
|
|
16937
|
+
{
|
|
16938
|
+
indexed: false,
|
|
16939
|
+
internalType: "address",
|
|
16940
|
+
name: "account",
|
|
16941
|
+
type: "address"
|
|
16942
|
+
}
|
|
16943
|
+
],
|
|
16944
|
+
name: "Unpaused",
|
|
16945
|
+
type: "event"
|
|
16946
|
+
},
|
|
16947
|
+
{
|
|
16948
|
+
anonymous: false,
|
|
16949
|
+
inputs: [
|
|
16950
|
+
{
|
|
16951
|
+
indexed: true,
|
|
16952
|
+
internalType: "address",
|
|
16953
|
+
name: "implementation",
|
|
16954
|
+
type: "address"
|
|
16955
|
+
}
|
|
16956
|
+
],
|
|
16957
|
+
name: "Upgraded",
|
|
16958
|
+
type: "event"
|
|
16959
|
+
},
|
|
16960
|
+
{
|
|
16961
|
+
inputs: [],
|
|
16962
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
16963
|
+
outputs: [
|
|
16964
|
+
{
|
|
16965
|
+
internalType: "bytes32",
|
|
16966
|
+
name: "",
|
|
16967
|
+
type: "bytes32"
|
|
16968
|
+
}
|
|
16969
|
+
],
|
|
16970
|
+
stateMutability: "view",
|
|
16971
|
+
type: "function"
|
|
16972
|
+
},
|
|
16973
|
+
{
|
|
16974
|
+
inputs: [],
|
|
16975
|
+
name: "EMERGENCY_PAUSE_ROLE",
|
|
16976
|
+
outputs: [
|
|
16977
|
+
{
|
|
16978
|
+
internalType: "bytes32",
|
|
16979
|
+
name: "",
|
|
16980
|
+
type: "bytes32"
|
|
16981
|
+
}
|
|
16982
|
+
],
|
|
16983
|
+
stateMutability: "view",
|
|
16984
|
+
type: "function"
|
|
16985
|
+
},
|
|
16986
|
+
{
|
|
16987
|
+
inputs: [],
|
|
16988
|
+
name: "REGISTRAR_ROLE",
|
|
16989
|
+
outputs: [
|
|
16990
|
+
{
|
|
16991
|
+
internalType: "bytes32",
|
|
16992
|
+
name: "",
|
|
16993
|
+
type: "bytes32"
|
|
16994
|
+
}
|
|
16995
|
+
],
|
|
16996
|
+
stateMutability: "view",
|
|
16997
|
+
type: "function"
|
|
16998
|
+
},
|
|
16999
|
+
{
|
|
17000
|
+
inputs: [],
|
|
17001
|
+
name: "SCOPE_MINT",
|
|
17002
|
+
outputs: [
|
|
17003
|
+
{
|
|
17004
|
+
internalType: "uint32",
|
|
17005
|
+
name: "",
|
|
17006
|
+
type: "uint32"
|
|
17007
|
+
}
|
|
17008
|
+
],
|
|
17009
|
+
stateMutability: "view",
|
|
17010
|
+
type: "function"
|
|
17011
|
+
},
|
|
17012
|
+
{
|
|
17013
|
+
inputs: [],
|
|
17014
|
+
name: "SCOPE_RENEW",
|
|
17015
|
+
outputs: [
|
|
17016
|
+
{
|
|
17017
|
+
internalType: "uint32",
|
|
17018
|
+
name: "",
|
|
17019
|
+
type: "uint32"
|
|
17020
|
+
}
|
|
17021
|
+
],
|
|
17022
|
+
stateMutability: "view",
|
|
17023
|
+
type: "function"
|
|
17024
|
+
},
|
|
17025
|
+
{
|
|
17026
|
+
inputs: [],
|
|
17027
|
+
name: "SCOPE_REPAY",
|
|
17028
|
+
outputs: [
|
|
17029
|
+
{
|
|
17030
|
+
internalType: "uint32",
|
|
17031
|
+
name: "",
|
|
17032
|
+
type: "uint32"
|
|
17033
|
+
}
|
|
17034
|
+
],
|
|
17035
|
+
stateMutability: "view",
|
|
17036
|
+
type: "function"
|
|
17037
|
+
},
|
|
17038
|
+
{
|
|
17039
|
+
inputs: [],
|
|
17040
|
+
name: "UPGRADE_INTERFACE_VERSION",
|
|
17041
|
+
outputs: [
|
|
17042
|
+
{
|
|
17043
|
+
internalType: "string",
|
|
17044
|
+
name: "",
|
|
17045
|
+
type: "string"
|
|
17046
|
+
}
|
|
17047
|
+
],
|
|
17048
|
+
stateMutability: "view",
|
|
17049
|
+
type: "function"
|
|
17050
|
+
},
|
|
17051
|
+
{
|
|
17052
|
+
inputs: [],
|
|
17053
|
+
name: "VERSION",
|
|
17054
|
+
outputs: [
|
|
17055
|
+
{
|
|
17056
|
+
internalType: "string",
|
|
17057
|
+
name: "",
|
|
17058
|
+
type: "string"
|
|
17059
|
+
}
|
|
17060
|
+
],
|
|
17061
|
+
stateMutability: "view",
|
|
17062
|
+
type: "function"
|
|
17063
|
+
},
|
|
17064
|
+
{
|
|
17065
|
+
inputs: [],
|
|
17066
|
+
name: "adminModule",
|
|
17067
|
+
outputs: [
|
|
17068
|
+
{
|
|
17069
|
+
internalType: "address",
|
|
17070
|
+
name: "",
|
|
17071
|
+
type: "address"
|
|
17072
|
+
}
|
|
17073
|
+
],
|
|
17074
|
+
stateMutability: "view",
|
|
17075
|
+
type: "function"
|
|
17076
|
+
},
|
|
17077
|
+
{
|
|
17078
|
+
inputs: [],
|
|
17079
|
+
name: "agentMintFloorMinBps",
|
|
17080
|
+
outputs: [
|
|
17081
|
+
{
|
|
17082
|
+
internalType: "uint32",
|
|
17083
|
+
name: "",
|
|
17084
|
+
type: "uint32"
|
|
17085
|
+
}
|
|
17086
|
+
],
|
|
17087
|
+
stateMutability: "view",
|
|
17088
|
+
type: "function"
|
|
17089
|
+
},
|
|
17090
|
+
{
|
|
17091
|
+
inputs: [
|
|
17092
|
+
{
|
|
17093
|
+
internalType: "address",
|
|
17094
|
+
name: "user",
|
|
17095
|
+
type: "address"
|
|
17096
|
+
}
|
|
17097
|
+
],
|
|
17098
|
+
name: "agentOf",
|
|
17099
|
+
outputs: [
|
|
17100
|
+
{
|
|
17101
|
+
components: [
|
|
17102
|
+
{
|
|
17103
|
+
internalType: "address",
|
|
17104
|
+
name: "agent",
|
|
17105
|
+
type: "address"
|
|
17106
|
+
},
|
|
17107
|
+
{
|
|
17108
|
+
internalType: "uint64",
|
|
17109
|
+
name: "validUntil",
|
|
17110
|
+
type: "uint64"
|
|
17111
|
+
},
|
|
17112
|
+
{
|
|
17113
|
+
internalType: "enum IAgentDelegateRegistryBase.AgentStatus",
|
|
17114
|
+
name: "status",
|
|
17115
|
+
type: "uint8"
|
|
17116
|
+
},
|
|
17117
|
+
{
|
|
17118
|
+
internalType: "uint64",
|
|
17119
|
+
name: "registeredAt",
|
|
17120
|
+
type: "uint64"
|
|
17121
|
+
},
|
|
17122
|
+
{
|
|
17123
|
+
internalType: "uint64",
|
|
17124
|
+
name: "revokedAt",
|
|
17125
|
+
type: "uint64"
|
|
17126
|
+
}
|
|
17127
|
+
],
|
|
17128
|
+
internalType: "struct IAgentDelegateRegistryBase.AgentRecord",
|
|
17129
|
+
name: "",
|
|
17130
|
+
type: "tuple"
|
|
17131
|
+
}
|
|
17132
|
+
],
|
|
17133
|
+
stateMutability: "view",
|
|
17134
|
+
type: "function"
|
|
17135
|
+
},
|
|
17136
|
+
{
|
|
17137
|
+
inputs: [],
|
|
17138
|
+
name: "authorizedConsumer",
|
|
17139
|
+
outputs: [
|
|
17140
|
+
{
|
|
17141
|
+
internalType: "address",
|
|
17142
|
+
name: "",
|
|
17143
|
+
type: "address"
|
|
17144
|
+
}
|
|
17145
|
+
],
|
|
17146
|
+
stateMutability: "view",
|
|
17147
|
+
type: "function"
|
|
17148
|
+
},
|
|
17149
|
+
{
|
|
17150
|
+
inputs: [
|
|
17151
|
+
{
|
|
17152
|
+
internalType: "bytes32",
|
|
17153
|
+
name: "positionId",
|
|
17154
|
+
type: "bytes32"
|
|
17155
|
+
},
|
|
17156
|
+
{
|
|
17157
|
+
internalType: "address",
|
|
17158
|
+
name: "caller",
|
|
17159
|
+
type: "address"
|
|
17160
|
+
}
|
|
17161
|
+
],
|
|
17162
|
+
name: "canMint",
|
|
17163
|
+
outputs: [
|
|
17164
|
+
{
|
|
17165
|
+
internalType: "bool",
|
|
17166
|
+
name: "ok",
|
|
17167
|
+
type: "bool"
|
|
17168
|
+
},
|
|
17169
|
+
{
|
|
17170
|
+
internalType: "enum IAgentDelegationRegistry.DenyReason",
|
|
17171
|
+
name: "reason",
|
|
17172
|
+
type: "uint8"
|
|
17173
|
+
},
|
|
17174
|
+
{
|
|
17175
|
+
internalType: "uint32",
|
|
17176
|
+
name: "effectiveFloorBps",
|
|
17177
|
+
type: "uint32"
|
|
17178
|
+
}
|
|
17179
|
+
],
|
|
17180
|
+
stateMutability: "view",
|
|
17181
|
+
type: "function"
|
|
17182
|
+
},
|
|
17183
|
+
{
|
|
17184
|
+
inputs: [
|
|
17185
|
+
{
|
|
17186
|
+
internalType: "bytes32",
|
|
17187
|
+
name: "positionId",
|
|
17188
|
+
type: "bytes32"
|
|
17189
|
+
},
|
|
17190
|
+
{
|
|
17191
|
+
internalType: "address",
|
|
17192
|
+
name: "caller",
|
|
17193
|
+
type: "address"
|
|
17194
|
+
}
|
|
17195
|
+
],
|
|
17196
|
+
name: "canRenew",
|
|
17197
|
+
outputs: [
|
|
17198
|
+
{
|
|
17199
|
+
internalType: "bool",
|
|
17200
|
+
name: "ok",
|
|
17201
|
+
type: "bool"
|
|
17202
|
+
},
|
|
17203
|
+
{
|
|
17204
|
+
internalType: "enum IAgentDelegationRegistry.DenyReason",
|
|
17205
|
+
name: "reason",
|
|
17206
|
+
type: "uint8"
|
|
17207
|
+
}
|
|
17208
|
+
],
|
|
17209
|
+
stateMutability: "view",
|
|
17210
|
+
type: "function"
|
|
17211
|
+
},
|
|
17212
|
+
{
|
|
17213
|
+
inputs: [
|
|
17214
|
+
{
|
|
17215
|
+
internalType: "bytes32",
|
|
17216
|
+
name: "positionId",
|
|
17217
|
+
type: "bytes32"
|
|
17218
|
+
},
|
|
17219
|
+
{
|
|
17220
|
+
internalType: "address",
|
|
17221
|
+
name: "caller",
|
|
17222
|
+
type: "address"
|
|
17223
|
+
}
|
|
17224
|
+
],
|
|
17225
|
+
name: "canRepay",
|
|
17226
|
+
outputs: [
|
|
17227
|
+
{
|
|
17228
|
+
internalType: "bool",
|
|
17229
|
+
name: "ok",
|
|
17230
|
+
type: "bool"
|
|
17231
|
+
},
|
|
17232
|
+
{
|
|
17233
|
+
internalType: "enum IAgentDelegationRegistry.DenyReason",
|
|
17234
|
+
name: "reason",
|
|
17235
|
+
type: "uint8"
|
|
17236
|
+
}
|
|
17237
|
+
],
|
|
17238
|
+
stateMutability: "view",
|
|
17239
|
+
type: "function"
|
|
17240
|
+
},
|
|
17241
|
+
{
|
|
17242
|
+
inputs: [],
|
|
17243
|
+
name: "core",
|
|
17244
|
+
outputs: [
|
|
17245
|
+
{
|
|
17246
|
+
internalType: "contract IPositionManagerCore",
|
|
17247
|
+
name: "",
|
|
17248
|
+
type: "address"
|
|
17249
|
+
}
|
|
17250
|
+
],
|
|
17251
|
+
stateMutability: "view",
|
|
17252
|
+
type: "function"
|
|
17253
|
+
},
|
|
17254
|
+
{
|
|
17255
|
+
inputs: [
|
|
17256
|
+
{
|
|
17257
|
+
internalType: "bytes32",
|
|
17258
|
+
name: "positionId",
|
|
17259
|
+
type: "bytes32"
|
|
17260
|
+
}
|
|
17261
|
+
],
|
|
17262
|
+
name: "disableAutoMint",
|
|
17263
|
+
outputs: [],
|
|
17264
|
+
stateMutability: "nonpayable",
|
|
17265
|
+
type: "function"
|
|
17266
|
+
},
|
|
17267
|
+
{
|
|
17268
|
+
inputs: [
|
|
17269
|
+
{
|
|
17270
|
+
internalType: "bytes32",
|
|
17271
|
+
name: "positionId",
|
|
17272
|
+
type: "bytes32"
|
|
17273
|
+
}
|
|
17274
|
+
],
|
|
17275
|
+
name: "disableAutoRenew",
|
|
17276
|
+
outputs: [],
|
|
17277
|
+
stateMutability: "nonpayable",
|
|
17278
|
+
type: "function"
|
|
17279
|
+
},
|
|
17280
|
+
{
|
|
17281
|
+
inputs: [
|
|
17282
|
+
{
|
|
17283
|
+
internalType: "bytes32",
|
|
17284
|
+
name: "positionId",
|
|
17285
|
+
type: "bytes32"
|
|
17286
|
+
}
|
|
17287
|
+
],
|
|
17288
|
+
name: "disableAutoRepay",
|
|
17289
|
+
outputs: [],
|
|
17290
|
+
stateMutability: "nonpayable",
|
|
17291
|
+
type: "function"
|
|
17292
|
+
},
|
|
17293
|
+
{
|
|
17294
|
+
inputs: [
|
|
17295
|
+
{
|
|
17296
|
+
internalType: "bytes32",
|
|
17297
|
+
name: "positionId",
|
|
17298
|
+
type: "bytes32"
|
|
17299
|
+
},
|
|
17300
|
+
{
|
|
17301
|
+
internalType: "uint32",
|
|
17302
|
+
name: "minCollateralRatioBps",
|
|
17303
|
+
type: "uint32"
|
|
17304
|
+
}
|
|
17305
|
+
],
|
|
17306
|
+
name: "enableAutoMint",
|
|
17307
|
+
outputs: [],
|
|
17308
|
+
stateMutability: "nonpayable",
|
|
17309
|
+
type: "function"
|
|
17310
|
+
},
|
|
17311
|
+
{
|
|
17312
|
+
inputs: [
|
|
17313
|
+
{
|
|
17314
|
+
internalType: "bytes32",
|
|
17315
|
+
name: "positionId",
|
|
17316
|
+
type: "bytes32"
|
|
17317
|
+
},
|
|
17318
|
+
{
|
|
17319
|
+
internalType: "uint32",
|
|
17320
|
+
name: "maxRenewals",
|
|
17321
|
+
type: "uint32"
|
|
17322
|
+
},
|
|
17323
|
+
{
|
|
17324
|
+
internalType: "uint40",
|
|
17325
|
+
name: "maxEndTimestamp",
|
|
17326
|
+
type: "uint40"
|
|
17327
|
+
}
|
|
17328
|
+
],
|
|
17329
|
+
name: "enableAutoRenew",
|
|
17330
|
+
outputs: [],
|
|
17331
|
+
stateMutability: "nonpayable",
|
|
17332
|
+
type: "function"
|
|
17333
|
+
},
|
|
17334
|
+
{
|
|
17335
|
+
inputs: [
|
|
17336
|
+
{
|
|
17337
|
+
internalType: "bytes32",
|
|
17338
|
+
name: "positionId",
|
|
17339
|
+
type: "bytes32"
|
|
17340
|
+
}
|
|
17341
|
+
],
|
|
17342
|
+
name: "enableAutoRepay",
|
|
17343
|
+
outputs: [],
|
|
17344
|
+
stateMutability: "nonpayable",
|
|
17345
|
+
type: "function"
|
|
17346
|
+
},
|
|
17347
|
+
{
|
|
17348
|
+
inputs: [
|
|
17349
|
+
{
|
|
17350
|
+
internalType: "bytes32",
|
|
17351
|
+
name: "positionId",
|
|
17352
|
+
type: "bytes32"
|
|
17353
|
+
}
|
|
17354
|
+
],
|
|
17355
|
+
name: "getLoanGrant",
|
|
17356
|
+
outputs: [
|
|
17357
|
+
{
|
|
17358
|
+
components: [
|
|
17359
|
+
{
|
|
17360
|
+
internalType: "address",
|
|
17361
|
+
name: "borrower",
|
|
17362
|
+
type: "address"
|
|
17363
|
+
},
|
|
17364
|
+
{
|
|
17365
|
+
internalType: "uint32",
|
|
17366
|
+
name: "scopeBits",
|
|
17367
|
+
type: "uint32"
|
|
17368
|
+
},
|
|
17369
|
+
{
|
|
17370
|
+
internalType: "uint32",
|
|
17371
|
+
name: "maxRenewals",
|
|
17372
|
+
type: "uint32"
|
|
17373
|
+
},
|
|
17374
|
+
{
|
|
17375
|
+
internalType: "uint32",
|
|
17376
|
+
name: "renewalsUsed",
|
|
17377
|
+
type: "uint32"
|
|
17378
|
+
},
|
|
17379
|
+
{
|
|
17380
|
+
internalType: "uint40",
|
|
17381
|
+
name: "maxEndTimestamp",
|
|
17382
|
+
type: "uint40"
|
|
17383
|
+
},
|
|
17384
|
+
{
|
|
17385
|
+
internalType: "uint32",
|
|
17386
|
+
name: "minCollateralRatioBps",
|
|
17387
|
+
type: "uint32"
|
|
17388
|
+
}
|
|
17389
|
+
],
|
|
17390
|
+
internalType: "struct IAgentDelegationRegistry.LoanGrant",
|
|
17391
|
+
name: "",
|
|
17392
|
+
type: "tuple"
|
|
17393
|
+
}
|
|
17394
|
+
],
|
|
17395
|
+
stateMutability: "view",
|
|
17396
|
+
type: "function"
|
|
17397
|
+
},
|
|
17398
|
+
{
|
|
17399
|
+
inputs: [
|
|
17400
|
+
{
|
|
17401
|
+
internalType: "bytes32",
|
|
17402
|
+
name: "role",
|
|
17403
|
+
type: "bytes32"
|
|
17404
|
+
}
|
|
17405
|
+
],
|
|
17406
|
+
name: "getRoleAdmin",
|
|
17407
|
+
outputs: [
|
|
17408
|
+
{
|
|
17409
|
+
internalType: "bytes32",
|
|
17410
|
+
name: "",
|
|
17411
|
+
type: "bytes32"
|
|
17412
|
+
}
|
|
17413
|
+
],
|
|
17414
|
+
stateMutability: "view",
|
|
17415
|
+
type: "function"
|
|
17416
|
+
},
|
|
17417
|
+
{
|
|
17418
|
+
inputs: [
|
|
17419
|
+
{
|
|
17420
|
+
internalType: "bytes32",
|
|
17421
|
+
name: "role",
|
|
17422
|
+
type: "bytes32"
|
|
17423
|
+
},
|
|
17424
|
+
{
|
|
17425
|
+
internalType: "uint256",
|
|
17426
|
+
name: "index",
|
|
17427
|
+
type: "uint256"
|
|
17428
|
+
}
|
|
17429
|
+
],
|
|
17430
|
+
name: "getRoleMember",
|
|
17431
|
+
outputs: [
|
|
17432
|
+
{
|
|
17433
|
+
internalType: "address",
|
|
17434
|
+
name: "",
|
|
17435
|
+
type: "address"
|
|
17436
|
+
}
|
|
17437
|
+
],
|
|
17438
|
+
stateMutability: "view",
|
|
17439
|
+
type: "function"
|
|
17440
|
+
},
|
|
17441
|
+
{
|
|
17442
|
+
inputs: [
|
|
17443
|
+
{
|
|
17444
|
+
internalType: "bytes32",
|
|
17445
|
+
name: "role",
|
|
17446
|
+
type: "bytes32"
|
|
17447
|
+
}
|
|
17448
|
+
],
|
|
17449
|
+
name: "getRoleMemberCount",
|
|
17450
|
+
outputs: [
|
|
17451
|
+
{
|
|
17452
|
+
internalType: "uint256",
|
|
17453
|
+
name: "",
|
|
17454
|
+
type: "uint256"
|
|
17455
|
+
}
|
|
17456
|
+
],
|
|
17457
|
+
stateMutability: "view",
|
|
17458
|
+
type: "function"
|
|
17459
|
+
},
|
|
17460
|
+
{
|
|
17461
|
+
inputs: [
|
|
17462
|
+
{
|
|
17463
|
+
internalType: "bytes32",
|
|
17464
|
+
name: "role",
|
|
17465
|
+
type: "bytes32"
|
|
17466
|
+
}
|
|
17467
|
+
],
|
|
17468
|
+
name: "getRoleMembers",
|
|
17469
|
+
outputs: [
|
|
17470
|
+
{
|
|
17471
|
+
internalType: "address[]",
|
|
17472
|
+
name: "",
|
|
17473
|
+
type: "address[]"
|
|
17474
|
+
}
|
|
17475
|
+
],
|
|
17476
|
+
stateMutability: "view",
|
|
17477
|
+
type: "function"
|
|
17478
|
+
},
|
|
17479
|
+
{
|
|
17480
|
+
inputs: [
|
|
17481
|
+
{
|
|
17482
|
+
internalType: "bytes32",
|
|
17483
|
+
name: "role",
|
|
17484
|
+
type: "bytes32"
|
|
17485
|
+
},
|
|
17486
|
+
{
|
|
17487
|
+
internalType: "address",
|
|
17488
|
+
name: "account",
|
|
17489
|
+
type: "address"
|
|
17490
|
+
}
|
|
17491
|
+
],
|
|
17492
|
+
name: "grantRole",
|
|
17493
|
+
outputs: [],
|
|
17494
|
+
stateMutability: "nonpayable",
|
|
17495
|
+
type: "function"
|
|
17496
|
+
},
|
|
17497
|
+
{
|
|
17498
|
+
inputs: [
|
|
17499
|
+
{
|
|
17500
|
+
internalType: "bytes32",
|
|
17501
|
+
name: "role",
|
|
17502
|
+
type: "bytes32"
|
|
17503
|
+
},
|
|
17504
|
+
{
|
|
17505
|
+
internalType: "address",
|
|
17506
|
+
name: "account",
|
|
17507
|
+
type: "address"
|
|
17508
|
+
}
|
|
17509
|
+
],
|
|
17510
|
+
name: "hasRole",
|
|
17511
|
+
outputs: [
|
|
17512
|
+
{
|
|
17513
|
+
internalType: "bool",
|
|
17514
|
+
name: "",
|
|
17515
|
+
type: "bool"
|
|
17516
|
+
}
|
|
17517
|
+
],
|
|
17518
|
+
stateMutability: "view",
|
|
17519
|
+
type: "function"
|
|
17520
|
+
},
|
|
17521
|
+
{
|
|
17522
|
+
inputs: [
|
|
17523
|
+
{
|
|
17524
|
+
internalType: "address",
|
|
17525
|
+
name: "admin",
|
|
17526
|
+
type: "address"
|
|
17527
|
+
},
|
|
17528
|
+
{
|
|
17529
|
+
internalType: "address",
|
|
17530
|
+
name: "adminModule_",
|
|
17531
|
+
type: "address"
|
|
17532
|
+
},
|
|
17533
|
+
{
|
|
17534
|
+
internalType: "address",
|
|
17535
|
+
name: "registrar",
|
|
17536
|
+
type: "address"
|
|
17537
|
+
},
|
|
17538
|
+
{
|
|
17539
|
+
internalType: "address",
|
|
17540
|
+
name: "pauser",
|
|
17541
|
+
type: "address"
|
|
17542
|
+
},
|
|
17543
|
+
{
|
|
17544
|
+
internalType: "contract IPositionManagerCore",
|
|
17545
|
+
name: "core_",
|
|
17546
|
+
type: "address"
|
|
17547
|
+
}
|
|
17548
|
+
],
|
|
17549
|
+
name: "initialize",
|
|
17550
|
+
outputs: [],
|
|
17551
|
+
stateMutability: "nonpayable",
|
|
17552
|
+
type: "function"
|
|
17553
|
+
},
|
|
17554
|
+
{
|
|
17555
|
+
inputs: [
|
|
17556
|
+
{
|
|
17557
|
+
internalType: "uint32",
|
|
17558
|
+
name: "floorMinBps",
|
|
17559
|
+
type: "uint32"
|
|
17560
|
+
}
|
|
17561
|
+
],
|
|
17562
|
+
name: "initializeV2",
|
|
17563
|
+
outputs: [],
|
|
17564
|
+
stateMutability: "nonpayable",
|
|
17565
|
+
type: "function"
|
|
17566
|
+
},
|
|
17567
|
+
{
|
|
17568
|
+
inputs: [
|
|
17569
|
+
{
|
|
17570
|
+
internalType: "address",
|
|
17571
|
+
name: "user",
|
|
17572
|
+
type: "address"
|
|
17573
|
+
}
|
|
17574
|
+
],
|
|
17575
|
+
name: "isAgentActive",
|
|
17576
|
+
outputs: [
|
|
17577
|
+
{
|
|
17578
|
+
internalType: "bool",
|
|
17579
|
+
name: "",
|
|
17580
|
+
type: "bool"
|
|
17581
|
+
}
|
|
17582
|
+
],
|
|
17583
|
+
stateMutability: "view",
|
|
17584
|
+
type: "function"
|
|
17585
|
+
},
|
|
17586
|
+
{
|
|
17587
|
+
inputs: [
|
|
17588
|
+
{
|
|
17589
|
+
internalType: "address",
|
|
17590
|
+
name: "",
|
|
17591
|
+
type: "address"
|
|
17592
|
+
}
|
|
17593
|
+
],
|
|
17594
|
+
name: "keyOfAgent",
|
|
17595
|
+
outputs: [
|
|
17596
|
+
{
|
|
17597
|
+
internalType: "bytes32",
|
|
17598
|
+
name: "",
|
|
17599
|
+
type: "bytes32"
|
|
17600
|
+
}
|
|
17601
|
+
],
|
|
17602
|
+
stateMutability: "view",
|
|
17603
|
+
type: "function"
|
|
17604
|
+
},
|
|
17605
|
+
{
|
|
17606
|
+
inputs: [],
|
|
17607
|
+
name: "maxAgentTtl",
|
|
17608
|
+
outputs: [
|
|
17609
|
+
{
|
|
17610
|
+
internalType: "uint64",
|
|
17611
|
+
name: "",
|
|
17612
|
+
type: "uint64"
|
|
17613
|
+
}
|
|
17614
|
+
],
|
|
17615
|
+
stateMutability: "view",
|
|
17616
|
+
type: "function"
|
|
17617
|
+
},
|
|
17618
|
+
{
|
|
17619
|
+
inputs: [],
|
|
17620
|
+
name: "pause",
|
|
17621
|
+
outputs: [],
|
|
17622
|
+
stateMutability: "nonpayable",
|
|
17623
|
+
type: "function"
|
|
17624
|
+
},
|
|
17625
|
+
{
|
|
17626
|
+
inputs: [],
|
|
17627
|
+
name: "paused",
|
|
17628
|
+
outputs: [
|
|
17629
|
+
{
|
|
17630
|
+
internalType: "bool",
|
|
17631
|
+
name: "",
|
|
17632
|
+
type: "bool"
|
|
17633
|
+
}
|
|
17634
|
+
],
|
|
17635
|
+
stateMutability: "view",
|
|
17636
|
+
type: "function"
|
|
17637
|
+
},
|
|
17638
|
+
{
|
|
17639
|
+
inputs: [],
|
|
17640
|
+
name: "proxiableUUID",
|
|
17641
|
+
outputs: [
|
|
17642
|
+
{
|
|
17643
|
+
internalType: "bytes32",
|
|
17644
|
+
name: "",
|
|
17645
|
+
type: "bytes32"
|
|
17646
|
+
}
|
|
17647
|
+
],
|
|
17648
|
+
stateMutability: "view",
|
|
17649
|
+
type: "function"
|
|
17650
|
+
},
|
|
17651
|
+
{
|
|
17652
|
+
inputs: [
|
|
17653
|
+
{
|
|
17654
|
+
internalType: "bytes32",
|
|
17655
|
+
name: "positionId",
|
|
17656
|
+
type: "bytes32"
|
|
17657
|
+
}
|
|
17658
|
+
],
|
|
17659
|
+
name: "recordRenewal",
|
|
17660
|
+
outputs: [],
|
|
17661
|
+
stateMutability: "nonpayable",
|
|
17662
|
+
type: "function"
|
|
17663
|
+
},
|
|
17664
|
+
{
|
|
17665
|
+
inputs: [
|
|
17666
|
+
{
|
|
17667
|
+
internalType: "address",
|
|
17668
|
+
name: "user",
|
|
17669
|
+
type: "address"
|
|
17670
|
+
},
|
|
17671
|
+
{
|
|
17672
|
+
internalType: "address",
|
|
17673
|
+
name: "agent",
|
|
17674
|
+
type: "address"
|
|
17675
|
+
},
|
|
17676
|
+
{
|
|
17677
|
+
internalType: "uint64",
|
|
17678
|
+
name: "validUntil",
|
|
17679
|
+
type: "uint64"
|
|
17680
|
+
}
|
|
17681
|
+
],
|
|
17682
|
+
name: "registerAgent",
|
|
17683
|
+
outputs: [],
|
|
17684
|
+
stateMutability: "nonpayable",
|
|
17685
|
+
type: "function"
|
|
17686
|
+
},
|
|
17687
|
+
{
|
|
17688
|
+
inputs: [
|
|
17689
|
+
{
|
|
17690
|
+
internalType: "bytes32",
|
|
17691
|
+
name: "role",
|
|
17692
|
+
type: "bytes32"
|
|
17693
|
+
},
|
|
17694
|
+
{
|
|
17695
|
+
internalType: "address",
|
|
17696
|
+
name: "callerConfirmation",
|
|
17697
|
+
type: "address"
|
|
17698
|
+
}
|
|
17699
|
+
],
|
|
17700
|
+
name: "renounceRole",
|
|
17701
|
+
outputs: [],
|
|
17702
|
+
stateMutability: "nonpayable",
|
|
17703
|
+
type: "function"
|
|
17704
|
+
},
|
|
17705
|
+
{
|
|
17706
|
+
inputs: [
|
|
17707
|
+
{
|
|
17708
|
+
internalType: "address",
|
|
17709
|
+
name: "user",
|
|
17710
|
+
type: "address"
|
|
17711
|
+
},
|
|
17712
|
+
{
|
|
17713
|
+
internalType: "bytes32",
|
|
17714
|
+
name: "reason",
|
|
17715
|
+
type: "bytes32"
|
|
17716
|
+
}
|
|
17717
|
+
],
|
|
17718
|
+
name: "revokeAgent",
|
|
17719
|
+
outputs: [],
|
|
17720
|
+
stateMutability: "nonpayable",
|
|
17721
|
+
type: "function"
|
|
17722
|
+
},
|
|
17723
|
+
{
|
|
17724
|
+
inputs: [
|
|
17725
|
+
{
|
|
17726
|
+
internalType: "bytes32",
|
|
17727
|
+
name: "role",
|
|
17728
|
+
type: "bytes32"
|
|
17729
|
+
},
|
|
17730
|
+
{
|
|
17731
|
+
internalType: "address",
|
|
17732
|
+
name: "account",
|
|
17733
|
+
type: "address"
|
|
17734
|
+
}
|
|
17735
|
+
],
|
|
17736
|
+
name: "revokeRole",
|
|
17737
|
+
outputs: [],
|
|
17738
|
+
stateMutability: "nonpayable",
|
|
17739
|
+
type: "function"
|
|
17740
|
+
},
|
|
17741
|
+
{
|
|
17742
|
+
inputs: [
|
|
17743
|
+
{
|
|
17744
|
+
internalType: "address",
|
|
17745
|
+
name: "user",
|
|
17746
|
+
type: "address"
|
|
17747
|
+
},
|
|
17748
|
+
{
|
|
17749
|
+
internalType: "address",
|
|
17750
|
+
name: "newAgent",
|
|
17751
|
+
type: "address"
|
|
17752
|
+
},
|
|
17753
|
+
{
|
|
17754
|
+
internalType: "uint64",
|
|
17755
|
+
name: "validUntil",
|
|
17756
|
+
type: "uint64"
|
|
17757
|
+
}
|
|
17758
|
+
],
|
|
17759
|
+
name: "rotateAgent",
|
|
17760
|
+
outputs: [],
|
|
17761
|
+
stateMutability: "nonpayable",
|
|
17762
|
+
type: "function"
|
|
17763
|
+
},
|
|
17764
|
+
{
|
|
17765
|
+
inputs: [
|
|
17766
|
+
{
|
|
17767
|
+
internalType: "address",
|
|
17768
|
+
name: "newAdminModule",
|
|
17769
|
+
type: "address"
|
|
17770
|
+
}
|
|
17771
|
+
],
|
|
17772
|
+
name: "setAdminModule",
|
|
17773
|
+
outputs: [],
|
|
17774
|
+
stateMutability: "nonpayable",
|
|
17775
|
+
type: "function"
|
|
17776
|
+
},
|
|
17777
|
+
{
|
|
17778
|
+
inputs: [
|
|
17779
|
+
{
|
|
17780
|
+
internalType: "uint32",
|
|
17781
|
+
name: "bps",
|
|
17782
|
+
type: "uint32"
|
|
17783
|
+
}
|
|
17784
|
+
],
|
|
17785
|
+
name: "setAgentMintFloorMin",
|
|
17786
|
+
outputs: [],
|
|
17787
|
+
stateMutability: "nonpayable",
|
|
17788
|
+
type: "function"
|
|
17789
|
+
},
|
|
17790
|
+
{
|
|
17791
|
+
inputs: [
|
|
17792
|
+
{
|
|
17793
|
+
internalType: "address",
|
|
17794
|
+
name: "consumer",
|
|
17795
|
+
type: "address"
|
|
17796
|
+
}
|
|
17797
|
+
],
|
|
17798
|
+
name: "setAuthorizedConsumer",
|
|
17799
|
+
outputs: [],
|
|
17800
|
+
stateMutability: "nonpayable",
|
|
17801
|
+
type: "function"
|
|
17802
|
+
},
|
|
17803
|
+
{
|
|
17804
|
+
inputs: [
|
|
17805
|
+
{
|
|
17806
|
+
internalType: "uint64",
|
|
17807
|
+
name: "newMaxAgentTtl",
|
|
17808
|
+
type: "uint64"
|
|
17809
|
+
}
|
|
17810
|
+
],
|
|
17811
|
+
name: "setMaxAgentTtl",
|
|
17812
|
+
outputs: [],
|
|
17813
|
+
stateMutability: "nonpayable",
|
|
17814
|
+
type: "function"
|
|
17815
|
+
},
|
|
17816
|
+
{
|
|
17817
|
+
inputs: [
|
|
17818
|
+
{
|
|
17819
|
+
internalType: "bytes32",
|
|
17820
|
+
name: "positionId",
|
|
17821
|
+
type: "bytes32"
|
|
17822
|
+
},
|
|
17823
|
+
{
|
|
17824
|
+
internalType: "uint32",
|
|
17825
|
+
name: "newFloorBps",
|
|
17826
|
+
type: "uint32"
|
|
17827
|
+
}
|
|
17828
|
+
],
|
|
17829
|
+
name: "setMintCollateralFloor",
|
|
17830
|
+
outputs: [],
|
|
17831
|
+
stateMutability: "nonpayable",
|
|
17832
|
+
type: "function"
|
|
17833
|
+
},
|
|
17834
|
+
{
|
|
17835
|
+
inputs: [
|
|
17836
|
+
{
|
|
17837
|
+
internalType: "bytes4",
|
|
17838
|
+
name: "interfaceId",
|
|
17839
|
+
type: "bytes4"
|
|
17840
|
+
}
|
|
17841
|
+
],
|
|
17842
|
+
name: "supportsInterface",
|
|
17843
|
+
outputs: [
|
|
17844
|
+
{
|
|
17845
|
+
internalType: "bool",
|
|
17846
|
+
name: "",
|
|
17847
|
+
type: "bool"
|
|
17848
|
+
}
|
|
17849
|
+
],
|
|
17850
|
+
stateMutability: "view",
|
|
17851
|
+
type: "function"
|
|
17852
|
+
},
|
|
17853
|
+
{
|
|
17854
|
+
inputs: [],
|
|
17855
|
+
name: "unpause",
|
|
17856
|
+
outputs: [],
|
|
17857
|
+
stateMutability: "nonpayable",
|
|
17858
|
+
type: "function"
|
|
17859
|
+
},
|
|
17860
|
+
{
|
|
17861
|
+
inputs: [
|
|
17862
|
+
{
|
|
17863
|
+
internalType: "address",
|
|
17864
|
+
name: "newImplementation",
|
|
17865
|
+
type: "address"
|
|
17866
|
+
},
|
|
17867
|
+
{
|
|
17868
|
+
internalType: "bytes",
|
|
17869
|
+
name: "data",
|
|
17870
|
+
type: "bytes"
|
|
17871
|
+
}
|
|
17872
|
+
],
|
|
17873
|
+
name: "upgradeToAndCall",
|
|
17874
|
+
outputs: [],
|
|
17875
|
+
stateMutability: "payable",
|
|
17876
|
+
type: "function"
|
|
17877
|
+
},
|
|
17878
|
+
{
|
|
17879
|
+
inputs: [
|
|
17880
|
+
{
|
|
17881
|
+
internalType: "address",
|
|
17882
|
+
name: "agent",
|
|
17883
|
+
type: "address"
|
|
17884
|
+
}
|
|
17885
|
+
],
|
|
17886
|
+
name: "userOfAgent",
|
|
17887
|
+
outputs: [
|
|
17888
|
+
{
|
|
17889
|
+
internalType: "address",
|
|
17890
|
+
name: "",
|
|
17891
|
+
type: "address"
|
|
17892
|
+
}
|
|
17893
|
+
],
|
|
17894
|
+
stateMutability: "view",
|
|
17895
|
+
type: "function"
|
|
17896
|
+
}
|
|
17897
|
+
];
|
|
17898
|
+
var _bytecode2 = "0x60a080604052346100ea57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460ff8160401c166100d9576002600160401b03196001600160401b03821601610073575b60405161308690816100f0823960805181818161121b015261140e0152f35b6001600160401b0319166001600160401b039081177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005581527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a13880610054565b63f92ee8a960e01b60005260046000fd5b600080fdfe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a7146120b4575080630d33f3c2146120905780630f3f4a94146120445780631459457a14611cfd578063188787e814611c2b57806318c38b8914611b1a5780631b02993114611aa65780631d44454114611a0b578063248a9ca3146119e55780632ec22d4c1461191c5780632f0647ce1461189d5780632f2ff15d1461186c57806336568abe14611826578063392f1087146117db5780633f4ba83a146116e35780633f5aadc9146116745780634f1ef28614611392578063523403631461129b5780635273b6f61461127257806352d1902d14611208578063554c4f4b14611178578063561b7f8a146110145780635bc26aea14610f875780635c975abb14610f575780636289d18c14610ed65780636711cc0b14610eba5780636e852a7814610da95780637e35bf6e14610d755780638343f67414610d485780638456cb5914610c525780638f33527f14610c185780639010d07c14610bc457806391d1485414610b6a5780639b9d30c114610b41578063a19af3f614610a7c578063a217fddf14610a60578063a3246ad31461099e578063a878086414610982578063ac3c0e3014610875578063ad3cb1cc1461082e578063b3fad6381461074b578063c34e9c261461072f578063c6fbbb87146105dd578063ca15c873146105a4578063d547741f1461056c578063dd71d99a1461052a578063e0922fa11461047d578063e187828314610454578063f2f4eb261461042b578063f68e955314610402578063fd437d39146102945763ffa1ad741461025b57600080fd5b3461028f57600036600319011261028f5761028b610277612282565b60405191829160208352602083019061225d565b0390f35b600080fd5b3461028f57606036600319011261028f576102ad612137565b6102b5612121565b906102be612224565b336000908152600080516020612f9a833981519152602052604090205490919060ff16156103db576001600160a01b031660008181526001602052604090208054939060e085901c60ff1660038110156103c5576001036103b45781600160209261034b877fc5d5c5bbf10444998e0ea6d4725e79027b574e1c14ec929279e8a9a95c6c6e919688612c79565b818060a01b038316828060a01b031982541617815561036a878261243b565b0180546001600160401b031916426001600160401b03908116919091179091556001600160a01b0391821660008181526002855260409081902087905551969091168652951693a4005b632437e77160e11b60005260046000fd5b634e487b7160e01b600052602160045260246000fd5b63e2517d3f60e01b6000523360045260008051602061301a83398151915260245260446000fd5b3461028f57600036600319011261028f57602060405160008051602061301a8339815191528152f35b3461028f57600036600319011261028f576003546040516001600160a01b039091168152602090f35b3461028f57600036600319011261028f576004546040516001600160a01b039091168152602090f35b3461028f57602036600319011261028f576004356001600160401b0381169081810361028f576000546001600160a01b038116330361051957600160a01b600160e01b0319811660a092831b600160a01b600160e01b031617600055604080519190921c6001600160401b0316815260208101929092527f9c195448332abd01f716db873b329752ea02f19d33f7e311fb0daf082c4edd0391a1005b6349db3bd360e01b60005260046000fd5b3461028f57602036600319011261028f576001600160a01b0361054b612137565b166000526002602052602060018060a01b0360406000205416604051908152f35b3461028f57604036600319011261028f576105a260043561058b612121565b9061059d61059882612302565b612a2c565b612abe565b005b3461028f57602036600319011261028f57600435600052600080516020612f1a8339815191526020526020604060002054604051908152f35b3461028f57602036600319011261028f5760043560018060a01b036004541633141580610708575b6106f757600081815260056020526040902080546001600160a01b038116156106e65760018160a01c16156106e65763ffffffff8160c01c1680151590816106d8575b506106c75760e01c6001019063ffffffff82116106b15780546001600160e01b031660e083901b6001600160e01b03191617905560405163ffffffff90911681527f859a3b34c0d733a1033c6089d4d18643a0705b707970a0d0d79c84423f089da190602090a2005b634e487b7160e01b600052601160045260246000fd5b638a6ea6bf60e01b60005260046000fd5b90508160e01c101584610648565b6360eb6c2360e01b60005260046000fd5b634b95b20b60e11b60005260046000fd5b50336000908152600080516020612f9a833981519152602052604090205460ff1615610605565b3461028f57600036600319011261028f57602060405160028152f35b3461028f57602036600319011261028f57600060a060405161076c816121cb565b8281528260208201528260408201528260608201528260808201520152600435600052600560205260c0604060002063ffffffff604051916107ad836121cb565b64ffffffffff8154938360018060a01b03861695868352816020840195818360a01c168752816001604087019282868e1c168452606088019560e01c86520154978160a060808901988a8c168a52019960281c1689526040519a8b52511660208a0152511660408801525116606086015251166080840152511660a0820152f35b3461028f57600036600319011261028f5761028b604080519061085181836121e6565b60058252640352e302e360dc1b60208301525191829160208352602083019061225d565b3461028f57602036600319011261028f5761088e612137565b6000608060405161089e8161219a565b828152826020820152826040820152826060820152015260018060a01b0316600052600160205260406000206040516108d68161219a565b81546001600160a01b038116825260a081901c6001600160401b03166020830190815292604083019160e01c60ff169060038210156103c557908252600101546001600160401b0380821660608501908152604092831c821660808601908152925194516001600160a01b03168552945116602084015290519260038410156103c557604083019390935291516001600160401b0390811660608301529151909116608082015260a090f35b3461028f57600036600319011261028f57602060405160018152f35b3461028f57602036600319011261028f57600435600052600080516020612f1a83398151915260205260406000206040518060208354918281520190819360005260206000209060005b818110610a4a57505050816109fe9103826121e6565b6040519182916020830190602084525180915260408301919060005b818110610a28575050500390f35b82516001600160a01b0316845285945060209384019390920191600101610a1a565b82548452602090930192600192830192016109e8565b3461028f57600036600319011261028f57602060405160008152f35b3461028f57604036600319011261028f57600435610a98612174565b90610aa1612639565b63ffffffff600654169163ffffffff811692808410908115610b38575b50610b275760206001610b147f1da95b87b4c773f68c1447ffc5644e41a8a8887d55065beb64852014cf7140be93610af586612684565b9390610b0e600463ffffffff835460a01c1617826122a5565b016122c8565b6040519485526001600160a01b031693a3005b634346c13160e01b60005260046000fd5b90501584610abe565b3461028f57600036600319011261028f576020604051600080516020612f5a8339815191528152f35b3461028f57604036600319011261028f57610b83612121565b600435600052600080516020612ffa83398151915260205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b3461028f57604036600319011261028f57600435600052600080516020612f1a8339815191526020526020610bff6024356040600020612d46565b905460405160039290921b1c6001600160a01b03168152f35b3461028f57602036600319011261028f576001600160a01b03610c39612137565b1660005260026020526020604060002054604051908152f35b3461028f57600036600319011261028f573360009081527f0ac8cc3d209806126662940717264973110c39045b305f6ba49613325a615e09602052604090205460ff1615610d2157610ca2612639565b600160ff1960008051602061303a83398151915254161760008051602061303a833981519152557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a16040514281527f80170b5fcdd2bf1e0660ef4b8851f86685f64d41b1a19de1471947ece8725aac60203392a2005b63e2517d3f60e01b60005233600452600080516020612f5a83398151915260245260446000fd5b3461028f57600036600319011261028f5760005460405160a09190911c6001600160401b03168152602090f35b3461028f57604036600319011261028f57610d99610d91612121565b6004356123a5565b9061028b6040519283928361215a565b3461028f57604036600319011261028f57610dc2612137565b336000908152600080516020612f9a833981519152602052604090205460ff161580610ea7575b610e97576001600160a01b03166000818152600160205260409020805460e01c60ff1660038110156103c5576001036103b457805460ff60e01b198116600160e11b1782556001919091018054600160401b600160801b03191642604090811b600160401b600160801b0316919091179091555160243581526001600160a01b0390911691907fc0499cc07ed9d734deec6857802d3f0fa8d5afaf79a7008beb8ba7bef62a271b90602090a3005b62fca64560e31b60005260046000fd5b50336001600160a01b0382161415610de9565b3461028f57600036600319011261028f57602060405160048152f35b3461028f57602036600319011261028f57610eef612187565b6000546001600160a01b031633036105195763ffffffff8116908115610f4657600080516020612fda83398151915291610f4163ffffffff9260065492841984161760065560405193849316836122eb565b0390a1005b6338f3377360e21b60005260046000fd5b3461028f57600036600319011261028f57602060ff60008051602061303a83398151915254166040519015158152f35b3461028f57602036600319011261028f57610fa0612137565b6000546001600160a01b0381169033829003610519576001600160a01b038316928315611003573b15610ff2576001600160a01b03191682176000908155600080516020612fba8339815191529080a3005b636f7c43f160e01b60005260046000fd5b63e6c4247b60e01b60005260046000fd5b3461028f57606036600319011261028f5761102d612137565b611035612121565b61103d612224565b91611046612639565b336000908152600080516020612f9a833981519152602052604090205460ff161580611165575b610e97576001600160a01b03166000818152600160205260409020805491929160e01c60ff1660038110156103c55760011461115457816020916110d3867ff223dc085722c94c84dcf67427e225799be616382a2a484d378f8921c69a20339587612c79565b80546001600160a01b0319166001600160a01b0383161781556110f6868261243b565b6001810180546001600160801b031916426001600160401b0390811691909117909155815460ff60e01b1916600160e01b179091556001600160a01b03919091166000818152600284526040908190208690555195909116855293a3005b639d2c8fdf60e01b60005260046000fd5b50336001600160a01b038216141561106d565b3461028f57602036600319011261028f576001600160a01b03611199612137565b166000526001602052604060002060ff60008051602061303a833981519152541615806111ec575b602091816111d5575b506040519015158152f35b5460a01c6001600160401b031642109050826111ca565b5060ff815460e01c169060038210156103c557906001146111c1565b3461028f57600036600319011261028f577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163003611261576020604051600080516020612f7a8339815191528152f35b63703e46dd60e11b60005260046000fd5b3461028f57600036600319011261028f576000546040516001600160a01b039091168152602090f35b3461028f57602036600319011261028f57600435600081815260056020526040902080546001600160a01b0381169291908315908115611383575b506106e657336000908152600080516020612f9a833981519152602052604090205460ff161580611379575b611368578061131e63fffffffe611341935460a01c16826122a5565b80546001600160c01b0316815560018101805464ffffffffff1916905582612a02565b7fa5ffbdba01b15df97334e34ad816b9986b6057a5ddc97aba93b7e8ccd21759ed600080a3005b630a606ec360e11b60005260046000fd5b5082331415611302565b6001915060a01c1615846112d6565b604036600319011261028f576113a6612137565b602435906001600160401b03821161028f573660238301121561028f578160040135906113d282612209565b916113e060405193846121e6565b8083526020830193366024838301011161028f57816000926024602093018737840101526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016308114908115611651575b50611261576000546001600160a01b03163303610519576001600160a01b03811692831561100357813b156116405730841461163157600080516020612f7a8339815191525484611488612282565b7f6ea8b34d59b2818d3f37a08dddaa06f5886b9c20c907b36f03ca6528e106e86f6114be6040519260408452604084019061225d565b4260208401526001600160a01b038516929081900390a36040516352d1902d60e01b8152602081600481895afa600091816115fd575b5061150e5785634c9c8ce360e01b60005260045260246000fd5b9081600080516020612f7a8339815191528793036115e95750833b156115d4576001600160a01b0319168117600080516020612f7a833981519152557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a28251156115b957600080916105a2945190845af43d156115b1573d9161159483612209565b926115a260405194856121e6565b83523d6000602085013e612eb8565b606091612eb8565b505050346115c357005b63b398979f60e01b60005260046000fd5b50634c9c8ce360e01b60005260045260246000fd5b632a87526960e21b60005260045260246000fd5b9091506020813d602011611629575b81611619602093836121e6565b8101031261028f575190876114f4565b3d915061160c565b614e8d60eb1b60005260046000fd5b632e07c4bd60e11b60005260046000fd5b600080516020612f7a833981519152546001600160a01b03161415905084611439565b3461028f57602036600319011261028f57600435611690612639565b6116b261169c82612684565b9190600263ffffffff825460a01c1617906122a5565b6001600160a01b0316907fc2713e691344add4705edc62a0ee5aede95ba66ad68f97316efef9cb50644edd600080a3005b3461028f57600036600319011261028f57336000908152600080516020612f9a833981519152602052604090205460ff1615806117c6575b6117b55760008051602061303a8339815191525460ff8116156117a45760ff191660008051602061303a833981519152557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a16040514281527f107553d8191d85b405879cf752997865edd48d94e20bda4dd27223c94b31a7cc60203392a2005b638dfc202b60e01b60005260046000fd5b63659a07b360e11b60005260046000fd5b506000546001600160a01b031633141561171b565b3461028f57604036600319011261028f57606061181e63ffffffff611809611801612121565b600435612323565b9193906040519415158552602085019061214d565b166040820152f35b3461028f57604036600319011261028f5761183f612121565b336001600160a01b0382160361185b576105a290600435612abe565b63334bd91960e11b60005260046000fd5b3461028f57604036600319011261028f576105a260043561188b612121565b9061189861059882612302565b612a76565b3461028f57602036600319011261028f576004356118eb6118bd82612990565b91906118d363fffffffb825460a01c16826122a5565b60018101805463ffffffff60281b1916905583612a02565b6001600160a01b0316907f09cb4ec44cdef8489412844b9682f87f7900758fa2bd7e039113e9125e538e0f600080a3005b3461028f57602036600319011261028f57600435600081815260056020526040902080546001600160a01b03811692919083159081156119d6575b506106e657336000908152600080516020612f9a833981519152602052604090205460ff1615806119cc575b611368578061199f63fffffffd6119a5935460a01c16826122a5565b82612a02565b7fb390ab029eab314bd18190ebe73d7e5c1c336beaa5c83ac22578378dc9ccc405600080a3005b5082331415611983565b6002915060a01c161584611957565b3461028f57602036600319011261028f576020611a03600435612302565b604051908152f35b3461028f57604036600319011261028f57600435611a27612174565b63ffffffff600654168063ffffffff831610908115611a9d575b50610b27577e8a218591d4362499c38c38eb1c12e7a7cc97a9068818d1fe6046a42ba4a5ba906001611a7284612990565b5001611a898263ffffffff835460281c16926122c8565b611a98604051928392836122eb565b0390a2005b90501583611a41565b3461028f57602036600319011261028f57611abf612137565b6000546001600160a01b0316330361051957600480546001600160a01b039283166001600160a01b0319821681179092559091167f8556037c5648b2d5b51736f07a8fa4d099812ef06abf79a5731be619b111e4d4600080a3005b3461028f57602036600319011261028f57611b33612187565b60008051602061305a8339815191525460ff8160401c16908115611c13575b50611c025760008051602061305a833981519152805460026001600160401b0319821681179092556000546001600160481b031990911690911791906001600160a01b031633036105195763ffffffff168015610f4657604081600080516020612fda8339815191529263ffffffff196006541617600655815190600082526020820152a160008051602061305a83398151915255600080516020612f3a833981519152602060405160028152a1005b63f92ee8a960e01b60005260046000fd5b60026001600160401b03919091161015905082611b52565b3461028f57606036600319011261028f57600435611c47612174565b9060443564ffffffffff811680910361028f57604060017ef8e9f2101420b089a9228a3e9fa546f669754196824e19ec1adab7cab1f2e992611c87612639565b611c9085612684565b9290611ca88263ffffffff835460a01c1617826122a5565b805463ffffffff60c01b60c08a901b1663ffffffff60c01b199091161760e083901b83900316815501805464ffffffffff191682179055825163ffffffff909616865260208601526001600160a01b031693a3005b3461028f5760a036600319011261028f57611d16612137565b611d1e612121565b906044356001600160a01b03811680820361028f576064356001600160a01b0381169182820361028f576084356001600160a01b038116949085900361028f5760008051602061305a83398151915254604081901c60ff161596906001600160401b03168015908161203c575b6001149081612032575b159081612029575b50611c025760008051602061305a83398151915280546001600160401b031916600117905586612004575b611dd0612b02565b611dd8612b02565b611de0612b02565b611de8612b02565b6001600160a01b038116908115611003578315611003578515611003576001600160a01b038916988915611003573b15610ff257611e27906000612b30565b9081611fbd575b5015611f0257611e4c9060008051602061301a833981519152612b30565b9081611f68575b5015611f0257611e7190600080516020612f5a833981519152612b30565b9081611f13575b5015611f0257600080546001600160a01b031916841781556040519390600080516020612fba8339815191528180a3801561100357803b15610ff257600380546001600160a01b031916919091179055611ece57005b60008051602061305a833981519152805460ff60401b1916905560018152600080516020612f3a83398151915290602090a1005b63cf5a8e3360e01b60005260046000fd5b600080516020612f5a833981519152600052600080516020612f1a833981519152602052611f61907ffff5b43478fa6840382eb63777e0da6941d320b940e3f70f0ea4780feff95827612d74565b5084611e78565b60008051602061301a833981519152600052600080516020612f1a833981519152602052611fb6907f32d31393d541a265984ec379cddd8b1fcbe5f2b0eb8ad81dddfead454f135eaa612d74565b5086611e53565b60008052600080516020612f1a833981519152602052611ffd907f615f0f9e84155bea8cc509fe18befeb1baf65611e38a6ba60964480fb29dfd44612d74565b5088611e2e565b60008051602061305a833981519152805460ff60401b1916600160401b179055611dc8565b90501589611d9d565b303b159150611d95565b889150611d8b565b3461028f57604036600319011261028f57612075612060612121565b60043560005260056020526040600020612464565b600a8110156103c55761028b9060405191818392158361215a565b3461028f57600036600319011261028f57602063ffffffff60065416604051908152f35b3461028f57602036600319011261028f576004359063ffffffff60e01b821680920361028f57602091635a05180f60e01b81149081156120f6575b5015158152f35b637965db0b60e01b811491508115612110575b50836120ef565b6301ffc9a760e01b14905083612109565b602435906001600160a01b038216820361028f57565b600435906001600160a01b038216820361028f57565b90600a8210156103c55752565b9015158152604081019291612172916020019061214d565b565b6024359063ffffffff8216820361028f57565b6004359063ffffffff8216820361028f57565b60a081019081106001600160401b038211176121b557604052565b634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b038211176121b557604052565b601f909101601f19168101906001600160401b038211908210176121b557604052565b6001600160401b0381116121b557601f01601f191660200190565b604435906001600160401b038216820361028f57565b60005b83811061224d5750506000910152565b818101518382015260200161223d565b906020916122768151809281855285808601910161223a565b601f01601f1916010190565b604051906122916040836121e6565b6005825264312e312e3160d81b6020830152565b805463ffffffff60a01b191660a09290921b63ffffffff60a01b16919091179055565b805463ffffffff60281b191660289290921b63ffffffff60281b16919091179055565b63ffffffff91821681529116602082015260400190565b600052600080516020612ffa83398151915260205260016040600020015490565b600052600560205261233a60406000209182612521565b600a8110156103c5578061239b5750600163ffffffff91015460281c1663ffffffff6006541681158015612393575b6123865780821061237f57505b60019160009190565b9050612376565b5050600090600390600090565b508015612369565b6000929091508290565b60005260056020526123bc604060002091826125ad565b600a8110156103c557806124335750805463ffffffff8160c01c168015159182612425575b505061241c576001015464ffffffffff168015159081612411575b5061240957600190600090565b600090600990565b9050421015386123fc565b50600090600890565b60e01c1015905038806123e1565b600092909150565b8054600160a01b600160e01b03191660a09290921b600160a01b600160e01b0316919091179055565b60ff60008051602061303a833981519152541661251a57546001600160a01b0381169081156125125760a01c6002161561250b5760005260016020526040600020549060ff8260e01c1660038110156103c5578015612503576002146124fc574260a083901c6001600160401b031611156124f5576001600160a01b039081169116036124f057600090565b600790565b5050600690565b5050600590565b505050600490565b5050600390565b505050600290565b5050600190565b60ff60008051602061303a833981519152541661251a57546001600160a01b0381169081156125125760a01c6004161561250b5760005260016020526040600020549060ff8260e01c1660038110156103c5578015612503576002146124fc574260a083901c6001600160401b031611156124f5576001600160a01b039081169116036124f057600090565b60ff60008051602061303a833981519152541661251a57546001600160a01b0381169081156125125760a01c6001161561250b5760005260016020526040600020549060ff8260e01c1660038110156103c5578015612503576002146124fc574260a083901c6001600160401b031611156124f5576001600160a01b039081169116036124f057600090565b60ff60008051602061303a833981519152541661265257565b63d93c066560e01b60005260046000fd5b519064ffffffffff8216820361028f57565b519061ffff8216820361028f57565b801561297f57600354604051638d34875560e01b8152600481018390529190600090839060249082906001600160a01b03165afa918215612973576000926127c8575b506080820151336000908152600080516020612f9a83398151915260205260409020546001600160a01b03909116929060ff1615806127be575b61136857610120015160088110156103c5576003811490600082156127b0575b821561279f575b505061278e5781600052600160205260ff60406000205460e01c1660038110156103c55760010361277d57600090815260056020526040902080546001600160a01b0319166001600160a01b03831617815591565b632e68d1d360e21b60005260046000fd5b63e9f6db8560e01b60005260046000fd5b9091506103c5576007143880612728565b506005811491506000612721565b5082331415612701565b90913d8082843e6127d981846121e6565b820191602081840312612953578051906001600160401b03821161295b5701906101a08284031261295057604051926101a084016001600160401b0381118582101761295f5760409081528351855260208085015190860152838101519085015260608301516001600160401b03811161295b57830181601f8201121561295b5780519061286682612209565b9261287460405194856121e6565b828452602083830101116129575790612893916020808501910161223a565b606084015260808201516001600160a01b03811681036129535760808401526128be60a08301612663565b60a08401526128cf60c08301612663565b60c08401526128e060e08301612675565b60e08401526128f26101008301612663565b610100840152610120820151906008821015612950575061294391610180916101208501526129246101408201612663565b6101408501526129376101608201612675565b61016085015201612663565b61018082015290386126c7565b80fd5b5080fd5b8380fd5b8280fd5b634e487b7160e01b83526041600452602483fd5b6040513d6000823e3d90fd5b637bb0b62160e01b60005260046000fd5b6000908152600560205260409020805490916001600160a01b0382169182159081156129f3575b506106e657336000908152600080516020612f9a833981519152602052604090205460ff1615806129e9575b61136857565b50813314156129e3565b6004915060a01c1615386129b7565b905460a01c63ffffffff1615612a155750565b600052600560205260006001604082208281550155565b6000818152600080516020612ffa8339815191526020908152604080832033845290915290205460ff1615612a5e5750565b63e2517d3f60e01b6000523360045260245260446000fd5b612a808282612b30565b9182612a8b57505090565b6000918252600080516020612f1a8339815191526020526040909120612aba916001600160a01b031690612d74565b5090565b612ac88282612bd9565b9182612ad357505090565b6000918252600080516020612f1a8339815191526020526040909120612aba916001600160a01b031690612de5565b60ff60008051602061305a8339815191525460401c1615612b1f57565b631afcd79f60e31b60005260046000fd5b6000818152600080516020612ffa833981519152602090815260408083206001600160a01b038616845290915290205460ff16612bd2576000818152600080516020612ffa833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19166001179055339291907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b5050600090565b6000818152600080516020612ffa833981519152602090815260408083206001600160a01b038616845290915290205460ff1615612bd2576000818152600080516020612ffa833981519152602090815260408083206001600160a01b0395909516808452949091528120805460ff19169055339291907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b9081158015612d35575b611003576001600160a01b0316600090815260026020526040902054801515919082612d2a575b5050612d19576001600160401b031642811115612d085760005460a01c6001600160401b03168015159182612cf3575b5050612ce257565b63e774e7b560e01b60005260046000fd5b9091504281039081116106b157113880612cda565b63efa7aefd60e01b60005260046000fd5b633b53f64f60e21b60005260046000fd5b141590503880612caa565b506001600160a01b03811615612c83565b8054821015612d5e5760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b6001810190826000528160205260406000205415600014612ddd578054600160401b8110156121b557612dc8612db1826001879401855584612d46565b819391549060031b91821b91600019901b19161790565b90555491600052602052604060002055600190565b505050600090565b9060018201918160005282602052604060002054801515600014612eaf5760001981018181116106b15782546000198101919082116106b157818103612e78575b50505080548015612e62576000190190612e408282612d46565b8154906000199060031b1b191690555560005260205260006040812055600190565b634e487b7160e01b600052603160045260246000fd5b612e98612e88612db19386612d46565b90549060031b1c92839286612d46565b905560005283602052604060002055388080612e26565b50505050600090565b90612ede5750805115612ecd57602081519101fd5b63d6bda27560e01b60005260046000fd5b81511580612f10575b612eef575090565b639996b31560e01b60009081526001600160a01b0391909116600452602490fd5b50803b15612ee756fec1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000c7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d275027301df982f5215b4963a854cf9c73219df80cb6acd8f098189c9480c7bbc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc07966f2ab141347034724e9b2a472c2f77f5cd745aeba27cacba797b8fcb708617dc5b1290f7495d7f8cc68476e6941aaf510598fa925d0d2720edc8805a846cd37bc77615afefc793aa17d75d4249a9b517ba91b0e54a49c9c4a44b3d7e228302dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800edcc084d3dcd65a1f7f23c65c46722faca6953d28e43150a467cf43e5c309238cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00a164736f6c6343000822000a";
|
|
17899
|
+
var isSuperArgs2 = (xs) => xs.length > 1;
|
|
17900
|
+
var AgentDelegationRegistry__factory = class extends import_ethers15.ContractFactory {
|
|
17901
|
+
constructor(...args) {
|
|
17902
|
+
if (isSuperArgs2(args)) {
|
|
17903
|
+
super(...args);
|
|
17904
|
+
} else {
|
|
17905
|
+
super(_abi2, _bytecode2, args[0]);
|
|
17906
|
+
}
|
|
17907
|
+
}
|
|
17908
|
+
getDeployTransaction(overrides) {
|
|
17909
|
+
return super.getDeployTransaction(overrides || {});
|
|
17910
|
+
}
|
|
17911
|
+
deploy(overrides) {
|
|
17912
|
+
return super.deploy(overrides || {});
|
|
17913
|
+
}
|
|
17914
|
+
connect(runner) {
|
|
17915
|
+
return super.connect(runner);
|
|
17916
|
+
}
|
|
17917
|
+
static bytecode = _bytecode2;
|
|
17918
|
+
static abi = _abi2;
|
|
17919
|
+
static createInterface() {
|
|
17920
|
+
return new import_ethers15.Interface(_abi2);
|
|
17921
|
+
}
|
|
17922
|
+
static connect(address, runner) {
|
|
17923
|
+
return new import_ethers15.Contract(
|
|
17924
|
+
address,
|
|
17925
|
+
_abi2,
|
|
17926
|
+
runner
|
|
17927
|
+
);
|
|
17928
|
+
}
|
|
17929
|
+
};
|
|
17930
|
+
|
|
17931
|
+
// src/utils/position-delegate.utils.ts
|
|
17932
|
+
var import_ethers16 = require("ethers");
|
|
17933
|
+
var POSITION_DELEGATE_REGISTRY_ABI = [
|
|
17934
|
+
"function positionDelegate(bytes32 positionId) view returns (address)",
|
|
17935
|
+
"function setPositionDelegate(bytes32 positionId, address newDelegate) external",
|
|
17936
|
+
"event PositionDelegateUpdated(bytes32 indexed positionId, address indexed oldDelegate, address indexed newDelegate)"
|
|
17937
|
+
];
|
|
17938
|
+
async function setPositionDelegate(positionId, delegate, signer, registryAddress) {
|
|
17939
|
+
const registry = new import_ethers16.Contract(
|
|
17940
|
+
registryAddress,
|
|
17941
|
+
POSITION_DELEGATE_REGISTRY_ABI,
|
|
17942
|
+
signer
|
|
17943
|
+
);
|
|
17944
|
+
return registry["setPositionDelegate"](positionId, delegate);
|
|
17945
|
+
}
|
|
17946
|
+
async function getPositionDelegate(positionId, provider, registryAddress) {
|
|
17947
|
+
const registry = new import_ethers16.Contract(
|
|
17948
|
+
registryAddress,
|
|
17949
|
+
POSITION_DELEGATE_REGISTRY_ABI,
|
|
17950
|
+
provider
|
|
17951
|
+
);
|
|
17952
|
+
return registry["positionDelegate"](positionId);
|
|
17953
|
+
}
|
|
17954
|
+
|
|
17955
|
+
// src/utils/agent-delegation.utils.ts
|
|
17956
|
+
async function mintAgentPkp(params) {
|
|
17957
|
+
const { serviceEndpoint, authHeader, timeoutMs = 3e4 } = params;
|
|
17958
|
+
if (!serviceEndpoint) {
|
|
17959
|
+
throw new Error(
|
|
17960
|
+
"serviceEndpoint is required to mint an agent PKP (SDK must be in service mode)"
|
|
17961
|
+
);
|
|
17962
|
+
}
|
|
17963
|
+
const url = `${serviceEndpoint}/api/lit/pkp/mint-agent`;
|
|
17964
|
+
const controller = new AbortController();
|
|
17965
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
17966
|
+
try {
|
|
17967
|
+
const headers = {
|
|
17968
|
+
"Content-Type": "application/json",
|
|
17969
|
+
...authHeader ? await authHeader() : {}
|
|
17970
|
+
};
|
|
17971
|
+
const response = await fetch(url, {
|
|
17972
|
+
method: "POST",
|
|
17973
|
+
headers,
|
|
17974
|
+
body: "{}",
|
|
17975
|
+
signal: controller.signal
|
|
17976
|
+
});
|
|
17977
|
+
if (!response.ok) {
|
|
17978
|
+
throw new Error(
|
|
17979
|
+
`Agent PKP mint failed (${response.status}): ${await response.text()}`
|
|
17980
|
+
);
|
|
17981
|
+
}
|
|
17982
|
+
const data = await response.json();
|
|
17983
|
+
if (!data.success || !data.walletAddress) {
|
|
17984
|
+
throw new Error(
|
|
17985
|
+
`Agent PKP mint returned no address: ${data.error ?? JSON.stringify(data)}`
|
|
17986
|
+
);
|
|
17987
|
+
}
|
|
17988
|
+
return data.walletAddress;
|
|
17989
|
+
} finally {
|
|
17990
|
+
clearTimeout(timeout);
|
|
17991
|
+
}
|
|
17992
|
+
}
|
|
17993
|
+
|
|
17994
|
+
// src/modules/mock/mock-token-manager.module.ts
|
|
17995
|
+
var MockTokenManager = class {
|
|
17996
|
+
config;
|
|
17997
|
+
constructor(config) {
|
|
17998
|
+
this.config = config;
|
|
17999
|
+
if (this.isProductionNetwork()) {
|
|
18000
|
+
log.warn("\u26A0\uFE0F MockTokenManager initialized on production network", {
|
|
18001
|
+
network: config.network
|
|
18002
|
+
});
|
|
18003
|
+
}
|
|
18004
|
+
}
|
|
18005
|
+
/**
|
|
18006
|
+
* Mint mock BTC tokens
|
|
18007
|
+
*
|
|
18008
|
+
* @param amount - Amount to mint in satoshis
|
|
18009
|
+
* @param recipient - Recipient address
|
|
18010
|
+
* @returns Transaction result
|
|
18011
|
+
*/
|
|
18012
|
+
async mintMockBTC(amount, recipient) {
|
|
18013
|
+
if (this.config.debug) {
|
|
18014
|
+
log.info("\u{1FA99} Minting mock BTC", {
|
|
18015
|
+
amount: amount.toString(),
|
|
18016
|
+
recipient
|
|
18017
|
+
});
|
|
18018
|
+
}
|
|
18019
|
+
if (this.isProductionNetwork()) {
|
|
18020
|
+
return failure(
|
|
18021
|
+
new SDKError({
|
|
18022
|
+
message: "Cannot mint mock tokens on production network",
|
|
18023
|
+
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
18024
|
+
severity: "HIGH" /* HIGH */,
|
|
18025
|
+
originalError: new Error("Production network detected")
|
|
18026
|
+
})
|
|
18027
|
+
);
|
|
18028
|
+
}
|
|
18029
|
+
return tryCatchAsync(
|
|
18030
|
+
async () => {
|
|
18031
|
+
const signerResult = this.config.contractManager.getSigner();
|
|
18032
|
+
if (!signerResult.success) {
|
|
18033
|
+
throw signerResult.error;
|
|
18034
|
+
}
|
|
18035
|
+
throw new Error("Mock BTC contract not yet integrated");
|
|
18036
|
+
},
|
|
18037
|
+
(error) => new SDKError({
|
|
18038
|
+
message: "Failed to mint mock BTC",
|
|
18039
|
+
category: "CONTRACT" /* CONTRACT */,
|
|
18040
|
+
severity: "MEDIUM" /* MEDIUM */,
|
|
18041
|
+
originalError: error instanceof Error ? error : new Error(String(error)),
|
|
18042
|
+
context: { amount: amount.toString(), recipient }
|
|
18043
|
+
})
|
|
18044
|
+
);
|
|
18045
|
+
}
|
|
18046
|
+
/**
|
|
18047
|
+
* Approve mock BTC spending
|
|
18048
|
+
*
|
|
18049
|
+
* @param spender - Spender address
|
|
18050
|
+
* @param amount - Amount to approve in satoshis
|
|
18051
|
+
* @returns Transaction result
|
|
18052
|
+
*/
|
|
18053
|
+
async approveMockBTC(spender, amount) {
|
|
18054
|
+
if (this.config.debug) {
|
|
18055
|
+
log.info("\u2705 Approving mock BTC spending", {
|
|
18056
|
+
spender,
|
|
18057
|
+
amount: amount.toString()
|
|
18058
|
+
});
|
|
18059
|
+
}
|
|
18060
|
+
if (this.isProductionNetwork()) {
|
|
18061
|
+
return failure(
|
|
18062
|
+
new SDKError({
|
|
18063
|
+
message: "Cannot approve mock tokens on production network",
|
|
18064
|
+
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
18065
|
+
severity: "HIGH" /* HIGH */,
|
|
18066
|
+
originalError: new Error("Production network detected")
|
|
18067
|
+
})
|
|
18068
|
+
);
|
|
18069
|
+
}
|
|
18070
|
+
return tryCatchAsync(
|
|
18071
|
+
async () => {
|
|
18072
|
+
const signerResult = this.config.contractManager.getSigner();
|
|
18073
|
+
if (!signerResult.success) {
|
|
18074
|
+
throw signerResult.error;
|
|
18075
|
+
}
|
|
18076
|
+
throw new Error("Mock BTC contract not yet integrated");
|
|
18077
|
+
},
|
|
18078
|
+
(error) => new SDKError({
|
|
18079
|
+
message: "Failed to approve mock BTC",
|
|
18080
|
+
category: "CONTRACT" /* CONTRACT */,
|
|
18081
|
+
severity: "MEDIUM" /* MEDIUM */,
|
|
18082
|
+
originalError: error instanceof Error ? error : new Error(String(error)),
|
|
18083
|
+
context: { spender, amount: amount.toString() }
|
|
18084
|
+
})
|
|
18085
|
+
);
|
|
18086
|
+
}
|
|
18087
|
+
/**
|
|
18088
|
+
* Get mock BTC balance
|
|
18089
|
+
*
|
|
18090
|
+
* @param address - Address to query
|
|
18091
|
+
* @returns Balance in satoshis
|
|
18092
|
+
*/
|
|
18093
|
+
async getMockBTCBalance(address) {
|
|
18094
|
+
if (this.config.debug) {
|
|
18095
|
+
log.info("\u{1F50D} Querying mock BTC balance", { address });
|
|
18096
|
+
}
|
|
18097
|
+
return tryCatchAsync(
|
|
18098
|
+
async () => {
|
|
18099
|
+
throw new Error("Mock BTC contract not yet integrated");
|
|
18100
|
+
},
|
|
18101
|
+
(error) => new SDKError({
|
|
18102
|
+
message: "Failed to get mock BTC balance",
|
|
18103
|
+
category: "CONTRACT" /* CONTRACT */,
|
|
18104
|
+
severity: "MEDIUM" /* MEDIUM */,
|
|
18105
|
+
originalError: error instanceof Error ? error : new Error(String(error)),
|
|
18106
|
+
context: { address }
|
|
18107
|
+
})
|
|
18108
|
+
);
|
|
18109
|
+
}
|
|
18110
|
+
/**
|
|
18111
|
+
* Check if current network is production (mainnet)
|
|
18112
|
+
*/
|
|
18113
|
+
isProductionNetwork() {
|
|
18114
|
+
return this.config.network.toLowerCase().includes("mainnet");
|
|
18115
|
+
}
|
|
18116
|
+
};
|
|
18117
|
+
function createMockTokenManager(config) {
|
|
18118
|
+
try {
|
|
18119
|
+
const manager = new MockTokenManager(config);
|
|
18120
|
+
return success(manager);
|
|
18121
|
+
} catch (error) {
|
|
18122
|
+
return failure(
|
|
18123
|
+
new SDKError({
|
|
18124
|
+
message: "Failed to create MockTokenManager",
|
|
18125
|
+
category: "INITIALIZATION" /* INITIALIZATION */,
|
|
18126
|
+
severity: "HIGH" /* HIGH */,
|
|
18127
|
+
originalError: error instanceof Error ? error : new Error(String(error))
|
|
18128
|
+
})
|
|
18129
|
+
);
|
|
18130
|
+
}
|
|
18131
|
+
}
|
|
18132
|
+
|
|
18133
|
+
// src/modules/diamond-hands-sdk.ts
|
|
18134
|
+
var import_dh_lit_ops = require("@gvnrdao/dh-lit-ops");
|
|
18135
|
+
var import_dh_lit_actions2 = __toESM(require_pkg_src());
|
|
18136
|
+
|
|
18137
|
+
// src/utils/telegram-messaging.utils.ts
|
|
18138
|
+
var TelegramBot = null;
|
|
18139
|
+
try {
|
|
18140
|
+
if (typeof window === "undefined" && typeof global !== "undefined") {
|
|
18141
|
+
TelegramBot = require("node-telegram-bot-api");
|
|
18142
|
+
}
|
|
18143
|
+
} catch (error) {
|
|
18144
|
+
log.warn("Telegram bot API not available", {
|
|
18145
|
+
error: error instanceof Error ? error.message : String(error)
|
|
18146
|
+
});
|
|
18147
|
+
}
|
|
18148
|
+
function formatMintMessage(mintAmount, loanId, txHash) {
|
|
18149
|
+
return `\u2705 DH SDK: ${mintAmount} UCD was minted for loan id: ${loanId} Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
18150
|
+
}
|
|
18151
|
+
function formatPartialPaymentMessage(paymentAmount, loanId, txHash) {
|
|
18152
|
+
return `\u2705 DH SDK: ${paymentAmount} UCD was repaid for loan id: ${loanId} Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
18153
|
+
}
|
|
18154
|
+
function formatPartialPaymentFailureMessage(paymentAmount, loanId, txHash) {
|
|
18155
|
+
const baseMessage = `\u274C DH SDK: FAILED to repay ${paymentAmount} UCD for loan id: ${loanId}`;
|
|
18156
|
+
if (txHash) {
|
|
18157
|
+
return `${baseMessage} Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
18158
|
+
}
|
|
18159
|
+
return baseMessage;
|
|
18160
|
+
}
|
|
18161
|
+
function formatLoanCreationMessage(positionId, pkpId, vaultAddress) {
|
|
18162
|
+
const vault = vaultAddress || "unknown";
|
|
18163
|
+
return `\u2705 DH SDK: A new loan was created Id: ${positionId} Pkp: ${pkpId} Regtest BTC vault: ${vault}`;
|
|
18164
|
+
}
|
|
18165
|
+
function formatBTCWithdrawalFailureMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId) {
|
|
18166
|
+
const formattedAmount = formatBTCAmount(withdrawalAmount);
|
|
18167
|
+
return `\u274C DH SDK: BTC withdrawal FAILED: ${formattedAmount} from ${btcVault} to ${btcDestinationAddress} for loan id: ${loanId}`;
|
|
18168
|
+
}
|
|
18169
|
+
function formatLoanRenewalMessage(positionId, txHash) {
|
|
18170
|
+
return `\u2705 DH SDK: Loan id ${positionId} was successfully renewed. Tx: https://sepolia.etherscan.io/tx/${txHash}`;
|
|
18171
|
+
}
|
|
18172
|
+
function formatLoanRenewalFailureMessage(loanId, error) {
|
|
18173
|
+
return `\u274C DH SDK: FAILED to renew loan id ${loanId} ${error}`;
|
|
18174
|
+
}
|
|
18175
|
+
function formatBalanceConfirmationMessage(loanId) {
|
|
18176
|
+
return `\u2705 DH SDK: Loan id: ${loanId} was updated to PENDING_MINT`;
|
|
18177
|
+
}
|
|
18178
|
+
function formatBalanceConfirmationFailureMessage(loanId) {
|
|
18179
|
+
return `\u274C DH SDK: FAILED to update to PENDING_MINT for loan id ${loanId}`;
|
|
18180
|
+
}
|
|
18181
|
+
function formatBTCWithdrawalSuccessMessage(withdrawalAmount, btcVault, btcDestinationAddress, loanId, btcTxId) {
|
|
18182
|
+
const formattedAmount = formatBTCAmount(withdrawalAmount);
|
|
18183
|
+
const txSuffix = btcTxId ? ` (tx: ${btcTxId})` : "";
|
|
18184
|
+
return `\u2705 DH SDK: BTC withdrawal SUCCEEDED: ${formattedAmount} sent from ${btcVault} to ${btcDestinationAddress} for loan id: ${loanId}${txSuffix}`;
|
|
18185
|
+
}
|
|
18186
|
+
function formatLiquidationSkippedMessage(loanId, ratio, threshold, btcVault, btcVaultBalance, ucdDebt, btcPrice) {
|
|
18187
|
+
const formattedPrice = formatBTCPrice(btcPrice);
|
|
18188
|
+
const formattedBalance = formatBTCAmount(btcVaultBalance);
|
|
16310
18189
|
return `\u2139\uFE0F DH SDK: Loan Id ${loanId} was not liquidated as the collateral ratio of ${ratio}% was above the liquidation threshold of ${threshold}%; BTC vault ${btcVault} balance is ${formattedBalance}, UCD Debt of ${ucdDebt} and BTC Price of ${formattedPrice}`;
|
|
16311
18190
|
}
|
|
16312
18191
|
function formatLiquidationSuccessMessage(loanId, ratio, threshold, btcVault, btcVaultBalance, ucdDebt, btcPrice) {
|
|
@@ -16722,7 +18601,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
16722
18601
|
*/
|
|
16723
18602
|
constructor(config) {
|
|
16724
18603
|
if (!config.provider && config.ethRpcUrl) {
|
|
16725
|
-
config.provider = new
|
|
18604
|
+
config.provider = new import_ethers17.JsonRpcProvider(config.ethRpcUrl);
|
|
16726
18605
|
}
|
|
16727
18606
|
this.config = config;
|
|
16728
18607
|
if (config.debug) {
|
|
@@ -16997,7 +18876,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
16997
18876
|
const network = await config.provider.getNetwork();
|
|
16998
18877
|
chainId = Number(network.chainId);
|
|
16999
18878
|
} else if (config.ethRpcUrl) {
|
|
17000
|
-
const tempProvider = new
|
|
18879
|
+
const tempProvider = new import_ethers17.JsonRpcProvider(
|
|
17001
18880
|
config.ethRpcUrl
|
|
17002
18881
|
);
|
|
17003
18882
|
const network = await tempProvider.getNetwork();
|
|
@@ -17533,7 +19412,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
17533
19412
|
}
|
|
17534
19413
|
const loanOps = this.loanOps();
|
|
17535
19414
|
const protocolConfig = await loanOps.getProtocolConfig();
|
|
17536
|
-
const requestAmountWei = (0,
|
|
19415
|
+
const requestAmountWei = (0, import_ethers17.parseEther)(
|
|
17537
19416
|
request.amount.toString()
|
|
17538
19417
|
);
|
|
17539
19418
|
const minLoanValueWei = BigInt(protocolConfig.minimumLoanValueWei);
|
|
@@ -17615,7 +19494,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
17615
19494
|
pkpNftAddress,
|
|
17616
19495
|
this.getChipotlePublicKeyFallback()
|
|
17617
19496
|
);
|
|
17618
|
-
pkpEthAddress = (0,
|
|
19497
|
+
pkpEthAddress = (0, import_ethers17.computeAddress)(pkpPublicKey);
|
|
17619
19498
|
pkpCache.set(request.positionId, {
|
|
17620
19499
|
publicKey: pkpPublicKey,
|
|
17621
19500
|
ethAddress: pkpEthAddress,
|
|
@@ -17944,8 +19823,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
17944
19823
|
throw new Error(`Position not found: ${request.positionId}`);
|
|
17945
19824
|
}
|
|
17946
19825
|
const currentDebt = position.ucdDebt.toString();
|
|
17947
|
-
const ucdDebtHash = (0,
|
|
17948
|
-
const contractHash = (0,
|
|
19826
|
+
const ucdDebtHash = (0, import_ethers17.keccak256)(import_ethers17.AbiCoder.defaultAbiCoder().encode(["uint256"], [currentDebt]));
|
|
19827
|
+
const contractHash = (0, import_ethers17.keccak256)(import_ethers17.AbiCoder.defaultAbiCoder().encode(
|
|
17949
19828
|
["address", "address", "address", "address"],
|
|
17950
19829
|
[
|
|
17951
19830
|
positionManagerAddress,
|
|
@@ -18014,7 +19893,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
18014
19893
|
const coreAbi = [
|
|
18015
19894
|
"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))"
|
|
18016
19895
|
];
|
|
18017
|
-
const positionCore = new
|
|
19896
|
+
const positionCore = new import_ethers17.Contract(
|
|
18018
19897
|
coreAddress,
|
|
18019
19898
|
coreAbi,
|
|
18020
19899
|
this.getSignerOrThrow().provider
|
|
@@ -18022,8 +19901,8 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
18022
19901
|
const currentPosition = await positionCore["getPositionDetails"](
|
|
18023
19902
|
positionIdBytes32
|
|
18024
19903
|
);
|
|
18025
|
-
const currentDebtHash = (0,
|
|
18026
|
-
|
|
19904
|
+
const currentDebtHash = (0, import_ethers17.keccak256)(
|
|
19905
|
+
import_ethers17.AbiCoder.defaultAbiCoder().encode(
|
|
18027
19906
|
["uint256"],
|
|
18028
19907
|
[currentPosition.ucdDebt]
|
|
18029
19908
|
)
|
|
@@ -18070,7 +19949,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
18070
19949
|
"function getCurrentQuantum() view returns (uint256)",
|
|
18071
19950
|
"function isQuantumValid(bytes32,uint256) view returns (bool)"
|
|
18072
19951
|
];
|
|
18073
|
-
const registry = new
|
|
19952
|
+
const registry = new import_ethers17.Contract(
|
|
18074
19953
|
registryAddress,
|
|
18075
19954
|
registryAbi,
|
|
18076
19955
|
this.getSignerOrThrow().provider
|
|
@@ -18186,7 +20065,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
18186
20065
|
});
|
|
18187
20066
|
}
|
|
18188
20067
|
const signatureHexMint = finalSignature.startsWith("0x") ? finalSignature : "0x" + finalSignature;
|
|
18189
|
-
const mintIface = new
|
|
20068
|
+
const mintIface = new import_ethers17.Interface(positionManagerAbi);
|
|
18190
20069
|
const mintCalldata = mintIface.encodeFunctionData("mintUCD", [
|
|
18191
20070
|
positionIdBytes32,
|
|
18192
20071
|
validationResponse.mintAmount,
|
|
@@ -18222,7 +20101,7 @@ var DiamondHandsSDK = class _DiamondHandsSDK {
|
|
|
18222
20101
|
if (viewsAddress) {
|
|
18223
20102
|
let diagnosis = null;
|
|
18224
20103
|
try {
|
|
18225
|
-
const views = new
|
|
20104
|
+
const views = new import_ethers17.Contract(
|
|
18226
20105
|
viewsAddress,
|
|
18227
20106
|
[
|
|
18228
20107
|
"function diagnoseMintUCD(bytes32,uint256,uint256,uint256,uint256,uint256,bytes32,bytes32,bytes32,uint256,bytes) view returns (string)"
|
|
@@ -18332,7 +20211,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
18332
20211
|
if (receipt.logs && receipt.logs.length > 0) {
|
|
18333
20212
|
for (const receiptLog of receipt.logs) {
|
|
18334
20213
|
if (receiptLog.topics && receiptLog.topics[0] === "0x08c379a0") {
|
|
18335
|
-
const iface = new
|
|
20214
|
+
const iface = new import_ethers17.Interface([
|
|
18336
20215
|
"error Error(string)"
|
|
18337
20216
|
]);
|
|
18338
20217
|
const decoded = iface.decodeErrorResult("Error", receiptLog.data);
|
|
@@ -18349,7 +20228,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
18349
20228
|
const minimalAbi = [
|
|
18350
20229
|
"event UCDMintedWithAuthorization(bytes32 indexed positionId, address indexed borrower, uint256 mintAmount, uint256 mintFee, uint256 newDebt, uint256 newCollateral, uint256 btcPrice, uint256 quantumTimestamp, bytes32 authorizedSpendsHash)"
|
|
18351
20230
|
];
|
|
18352
|
-
const iface = new
|
|
20231
|
+
const iface = new import_ethers17.Interface(minimalAbi);
|
|
18353
20232
|
for (const receiptLog of receipt.logs) {
|
|
18354
20233
|
const parsed = (() => {
|
|
18355
20234
|
const logIface = iface;
|
|
@@ -18536,7 +20415,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
18536
20415
|
pkpNftAddress,
|
|
18537
20416
|
this.getChipotlePublicKeyFallback()
|
|
18538
20417
|
);
|
|
18539
|
-
const pkpEthAddress = (0,
|
|
20418
|
+
const pkpEthAddress = (0, import_ethers17.computeAddress)(pkpPublicKey);
|
|
18540
20419
|
pkpData = {
|
|
18541
20420
|
publicKey: pkpPublicKey,
|
|
18542
20421
|
ethAddress: pkpEthAddress,
|
|
@@ -18938,7 +20817,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
18938
20817
|
}
|
|
18939
20818
|
const loanOpsForUcd = loanOpsForUcdResult.value;
|
|
18940
20819
|
const ucdTokenAddress = await loanOpsForUcd.ucdToken();
|
|
18941
|
-
const ucdToken = new
|
|
20820
|
+
const ucdToken = new import_ethers17.Contract(
|
|
18942
20821
|
ucdTokenAddress,
|
|
18943
20822
|
[
|
|
18944
20823
|
"function balanceOf(address) view returns (uint256)",
|
|
@@ -18954,9 +20833,9 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
18954
20833
|
if (ucdBalance < debtWei) {
|
|
18955
20834
|
return {
|
|
18956
20835
|
success: false,
|
|
18957
|
-
error: `Insufficient UCD balance for liquidation: ${(0,
|
|
20836
|
+
error: `Insufficient UCD balance for liquidation: ${(0, import_ethers17.formatEther)(
|
|
18958
20837
|
ucdBalance
|
|
18959
|
-
)} UCD (need ${(0,
|
|
20838
|
+
)} UCD (need ${(0, import_ethers17.formatEther)(debtWei)} UCD)`,
|
|
18960
20839
|
positionId: request.positionId,
|
|
18961
20840
|
wasLiquidated: false
|
|
18962
20841
|
};
|
|
@@ -18965,7 +20844,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
18965
20844
|
if (request.skipUcdApproval) {
|
|
18966
20845
|
return {
|
|
18967
20846
|
success: false,
|
|
18968
|
-
error: `Insufficient UCD allowance for UCDController: need at least ${(0,
|
|
20847
|
+
error: `Insufficient UCD allowance for UCDController: need at least ${(0, import_ethers17.formatEther)(
|
|
18969
20848
|
debtWei
|
|
18970
20849
|
)} UCD, or omit skipUcdApproval to let the SDK submit approve`,
|
|
18971
20850
|
positionId: request.positionId,
|
|
@@ -19472,7 +21351,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
19472
21351
|
if (typeof signatureBytes === "string" && signatureBytes.startsWith("{")) {
|
|
19473
21352
|
try {
|
|
19474
21353
|
const parsed = JSON.parse(signatureBytes);
|
|
19475
|
-
signatureBytes = parsed.signature ?? (parsed.r && parsed.s && parsed.v ?
|
|
21354
|
+
signatureBytes = parsed.signature ?? (parsed.r && parsed.s && parsed.v ? import_ethers17.Signature.from({
|
|
19476
21355
|
r: parsed.r,
|
|
19477
21356
|
s: parsed.s,
|
|
19478
21357
|
v: parsed.v
|
|
@@ -19483,7 +21362,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
19483
21362
|
if (!signatureBytes.startsWith("0x")) {
|
|
19484
21363
|
signatureBytes = "0x" + signatureBytes;
|
|
19485
21364
|
}
|
|
19486
|
-
const extendIface = new
|
|
21365
|
+
const extendIface = new import_ethers17.Interface([
|
|
19487
21366
|
"function extendPosition(bytes32 positionId, uint256 selectedTerm, uint256 quantumTimestamp, uint256 btcPrice, uint256 availableBTCBalance, uint256 proRataRenewalFee, bytes calldata extensionValidatorSignature) external returns (bool)"
|
|
19488
21367
|
]);
|
|
19489
21368
|
const extendCalldata = extendIface.encodeFunctionData("extendPosition", [
|
|
@@ -20033,7 +21912,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20033
21912
|
` Converting payment amount: ${request.paymentAmount} (type: ${typeof request.paymentAmount})`
|
|
20034
21913
|
);
|
|
20035
21914
|
}
|
|
20036
|
-
const paymentAmountWei = (0,
|
|
21915
|
+
const paymentAmountWei = (0, import_ethers17.parseEther)(
|
|
20037
21916
|
request.paymentAmount.toString()
|
|
20038
21917
|
);
|
|
20039
21918
|
if (this.config.debug) {
|
|
@@ -20095,7 +21974,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20095
21974
|
};
|
|
20096
21975
|
}
|
|
20097
21976
|
const ucdTokenAddress = await loanOps.ucdToken();
|
|
20098
|
-
const ucdToken = new
|
|
21977
|
+
const ucdToken = new import_ethers17.Contract(
|
|
20099
21978
|
ucdTokenAddress,
|
|
20100
21979
|
[
|
|
20101
21980
|
"function balanceOf(address) view returns (uint256)",
|
|
@@ -20105,31 +21984,41 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20105
21984
|
signer
|
|
20106
21985
|
);
|
|
20107
21986
|
const signerAddress = await signer.getAddress();
|
|
21987
|
+
let fundsSource = signerAddress;
|
|
21988
|
+
try {
|
|
21989
|
+
const posView = await this.getPositionDetailsView(request.positionId);
|
|
21990
|
+
if (posView?.borrower)
|
|
21991
|
+
fundsSource = posView.borrower;
|
|
21992
|
+
} catch {
|
|
21993
|
+
}
|
|
21994
|
+
const isSelfRepay = fundsSource.toLowerCase() === signerAddress.toLowerCase();
|
|
20108
21995
|
const [balance, allowance] = await Promise.all([
|
|
20109
|
-
ucdToken["balanceOf"](
|
|
20110
|
-
ucdToken["allowance"](
|
|
21996
|
+
ucdToken["balanceOf"](fundsSource),
|
|
21997
|
+
ucdToken["allowance"](fundsSource, positionManagerAddress)
|
|
20111
21998
|
]);
|
|
20112
21999
|
if (this.config.debug) {
|
|
20113
|
-
log.info(` UCD
|
|
20114
|
-
log.info(
|
|
20115
|
-
|
|
20116
|
-
);
|
|
22000
|
+
log.info(` UCD funds source: ${fundsSource}${isSelfRepay ? " (self)" : " (borrower; agent submitting)"}`);
|
|
22001
|
+
log.info(` UCD Balance: ${(0, import_ethers17.formatEther)(balance)} UCD`);
|
|
22002
|
+
log.info(` UCD Allowance: ${(0, import_ethers17.formatEther)(allowance)} UCD`);
|
|
20117
22003
|
log.info(` Required: ${request.paymentAmount} UCD`);
|
|
20118
22004
|
}
|
|
20119
22005
|
if (balance < paymentAmountWei) {
|
|
20120
22006
|
return {
|
|
20121
22007
|
success: false,
|
|
20122
|
-
error: `Insufficient UCD balance: ${(0,
|
|
22008
|
+
error: `Insufficient UCD balance: ${(0, import_ethers17.formatEther)(
|
|
20123
22009
|
balance
|
|
20124
|
-
)} UCD (need ${request.paymentAmount} UCD)`
|
|
22010
|
+
)} UCD (need ${request.paymentAmount} UCD)${isSelfRepay ? "" : ` \u2014 borrower ${fundsSource} lacks funds`}`
|
|
20125
22011
|
};
|
|
20126
22012
|
}
|
|
20127
22013
|
if (allowance < paymentAmountWei) {
|
|
22014
|
+
if (!isSelfRepay) {
|
|
22015
|
+
return {
|
|
22016
|
+
success: false,
|
|
22017
|
+
error: `Borrower ${fundsSource} has insufficient UCD allowance to PositionManager (${(0, import_ethers17.formatEther)(allowance)} UCD, need ${request.paymentAmount}). The borrower must approve PositionManager before a delegated agent can repay.`
|
|
22018
|
+
};
|
|
22019
|
+
}
|
|
20128
22020
|
if (this.config.debug) {
|
|
20129
|
-
log.info(
|
|
20130
|
-
" Insufficient allowance, sending approval transaction...",
|
|
20131
|
-
{}
|
|
20132
|
-
);
|
|
22021
|
+
log.info(" Insufficient allowance, sending approval transaction...", {});
|
|
20133
22022
|
}
|
|
20134
22023
|
const approveTx = await ucdToken["approve"](
|
|
20135
22024
|
positionManagerAddress,
|
|
@@ -20137,16 +22026,13 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20137
22026
|
);
|
|
20138
22027
|
if (this.config.debug) {
|
|
20139
22028
|
log.info(` Approval tx sent: ${approveTx.hash}`);
|
|
20140
|
-
log.info(" Waiting for approval confirmation...", {});
|
|
20141
22029
|
}
|
|
20142
22030
|
await approveTx.wait();
|
|
20143
22031
|
if (this.config.debug) {
|
|
20144
22032
|
log.info(" \u2705 UCD approval confirmed", {});
|
|
20145
22033
|
}
|
|
20146
|
-
} else {
|
|
20147
|
-
|
|
20148
|
-
log.info(" \u2705 Sufficient allowance already exists", {});
|
|
20149
|
-
}
|
|
22034
|
+
} else if (this.config.debug) {
|
|
22035
|
+
log.info(" \u2705 Sufficient allowance already exists", {});
|
|
20150
22036
|
}
|
|
20151
22037
|
let auth;
|
|
20152
22038
|
try {
|
|
@@ -20388,7 +22274,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20388
22274
|
const paymentSigner = this.getSignerOrThrow();
|
|
20389
22275
|
const paymentFrom = await paymentSigner.getAddress();
|
|
20390
22276
|
const paymentProvider = contractManager.getProvider();
|
|
20391
|
-
const paymentIface = new
|
|
22277
|
+
const paymentIface = new import_ethers17.Interface([
|
|
20392
22278
|
"function makePayment(bytes32 positionId, uint256 paymentAmount, uint256 quantumTimestamp, uint256 btcPrice, bytes calldata paymentValidatorSignature) external returns (bool)"
|
|
20393
22279
|
]);
|
|
20394
22280
|
const paymentCalldata = paymentIface.encodeFunctionData("makePayment", [
|
|
@@ -20705,7 +22591,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20705
22591
|
const pkpId = position.pkpId;
|
|
20706
22592
|
if (litValidatorAddr && pkpId) {
|
|
20707
22593
|
try {
|
|
20708
|
-
const litValidator = new
|
|
22594
|
+
const litValidator = new import_ethers17.Contract(
|
|
20709
22595
|
litValidatorAddr,
|
|
20710
22596
|
["function pkpOwners(bytes32) view returns (address)"],
|
|
20711
22597
|
this.getProviderOrThrow()
|
|
@@ -20713,7 +22599,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20713
22599
|
const owner = await litValidator.pkpOwners(
|
|
20714
22600
|
pkpId
|
|
20715
22601
|
);
|
|
20716
|
-
if (owner && owner !==
|
|
22602
|
+
if (owner && owner !== import_ethers17.ZeroAddress) {
|
|
20717
22603
|
controller = owner;
|
|
20718
22604
|
}
|
|
20719
22605
|
} catch {
|
|
@@ -20765,7 +22651,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
20765
22651
|
pkpNftAddress,
|
|
20766
22652
|
this.getChipotlePublicKeyFallback()
|
|
20767
22653
|
);
|
|
20768
|
-
pkpEthAddress = (0,
|
|
22654
|
+
pkpEthAddress = (0, import_ethers17.computeAddress)(pkpPublicKey);
|
|
20769
22655
|
pkpCache.set(positionId, {
|
|
20770
22656
|
publicKey: pkpPublicKey,
|
|
20771
22657
|
ethAddress: pkpEthAddress,
|
|
@@ -21128,7 +23014,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21128
23014
|
utxoVout: withdrawalParams.utxoVout
|
|
21129
23015
|
});
|
|
21130
23016
|
}
|
|
21131
|
-
const withdrawIface = new
|
|
23017
|
+
const withdrawIface = new import_ethers17.Interface([
|
|
21132
23018
|
"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)"
|
|
21133
23019
|
]);
|
|
21134
23020
|
const withdrawCalldata = withdrawIface.encodeFunctionData("withdrawBTC", [
|
|
@@ -21320,7 +23206,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21320
23206
|
}
|
|
21321
23207
|
const pkpId = positionDetails.pkpId;
|
|
21322
23208
|
const vaultAddress = positionDetails.vaultAddress;
|
|
21323
|
-
if (!pkpId || pkpId ===
|
|
23209
|
+
if (!pkpId || pkpId === import_ethers17.ZeroHash) {
|
|
21324
23210
|
return { success: false, error: "Position has no PKP" };
|
|
21325
23211
|
}
|
|
21326
23212
|
if (!vaultAddress) {
|
|
@@ -21340,7 +23226,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21340
23226
|
if (!publicKey) {
|
|
21341
23227
|
return { success: false, error: "Failed to resolve PKP public key" };
|
|
21342
23228
|
}
|
|
21343
|
-
const chipotlePkpAddress = (0,
|
|
23229
|
+
const chipotlePkpAddress = (0, import_ethers17.computeAddress)(publicKey);
|
|
21344
23230
|
const STANDALONE_CHAIN_NAMES = {
|
|
21345
23231
|
1: "ethereum",
|
|
21346
23232
|
11155111: "sepolia",
|
|
@@ -21690,7 +23576,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21690
23576
|
const btcSpendAuthorizerAbi = [
|
|
21691
23577
|
"function getAuthorizedSpends(bytes32) view returns (tuple(string txid, uint32 vout, uint256 satoshis, string targetAddress, uint256 targetAmount, uint256 authorizedAt)[])"
|
|
21692
23578
|
];
|
|
21693
|
-
const btcSpendAuthorizer = new
|
|
23579
|
+
const btcSpendAuthorizer = new import_ethers17.Contract(
|
|
21694
23580
|
btcSpendAuthorizerAddress,
|
|
21695
23581
|
btcSpendAuthorizerAbi,
|
|
21696
23582
|
this.getProviderOrThrow()
|
|
@@ -21776,7 +23662,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21776
23662
|
const abi = [
|
|
21777
23663
|
"function getAuthorizedSpends(bytes32) view returns (tuple(string txid, uint32 vout, uint256 satoshis, string targetAddress, uint256 targetAmount, uint256 authorizedAt)[])"
|
|
21778
23664
|
];
|
|
21779
|
-
const contract = new
|
|
23665
|
+
const contract = new import_ethers17.Contract(
|
|
21780
23666
|
btcSpendAuthorizerAddress,
|
|
21781
23667
|
abi,
|
|
21782
23668
|
this.getProviderOrThrow()
|
|
@@ -21790,7 +23676,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21790
23676
|
targetAddress: spend.targetAddress,
|
|
21791
23677
|
targetAmount: Number(spend.targetAmount),
|
|
21792
23678
|
authorizedAt: Number(spend.authorizedAt),
|
|
21793
|
-
utxoKey: (0,
|
|
23679
|
+
utxoKey: (0, import_ethers17.solidityPackedKeccak256)(
|
|
21794
23680
|
["string", "uint32"],
|
|
21795
23681
|
[spend.txid, Number(spend.vout)]
|
|
21796
23682
|
)
|
|
@@ -21963,7 +23849,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
21963
23849
|
error: attRes.error ?? attRes.reason ?? `LIT recovery attestation rejected${attRes.failedStep ? ` at step ${attRes.failedStep}` : ""}`
|
|
21964
23850
|
};
|
|
21965
23851
|
}
|
|
21966
|
-
const btcSpendAuthorizer = new
|
|
23852
|
+
const btcSpendAuthorizer = new import_ethers17.Contract(
|
|
21967
23853
|
btcSpendAuthorizerAddress,
|
|
21968
23854
|
[
|
|
21969
23855
|
"function cancelStaleSpendWithProof(bytes32 positionId, bytes32 utxoKey, uint256 authorizedAt, string calldata invalidatorTxid, uint256 attestationTimestamp, bytes calldata litSignature) external"
|
|
@@ -22060,7 +23946,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22060
23946
|
const positionDetails = await this.getPositionDetailsView(
|
|
22061
23947
|
params.positionId
|
|
22062
23948
|
);
|
|
22063
|
-
if (!positionDetails?.pkpId || positionDetails.pkpId ===
|
|
23949
|
+
if (!positionDetails?.pkpId || positionDetails.pkpId === import_ethers17.ZeroHash) {
|
|
22064
23950
|
return { success: false, error: "Position has no PKP" };
|
|
22065
23951
|
}
|
|
22066
23952
|
const pkpCache = this.cacheManager.getCache("pkp-data", {
|
|
@@ -22077,7 +23963,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22077
23963
|
if (!publicKey) {
|
|
22078
23964
|
return { success: false, error: "Failed to resolve PKP public key" };
|
|
22079
23965
|
}
|
|
22080
|
-
const chipotlePkpAddress = (0,
|
|
23966
|
+
const chipotlePkpAddress = (0, import_ethers17.computeAddress)(publicKey);
|
|
22081
23967
|
const dc = this.config.contractAddresses || {};
|
|
22082
23968
|
const chainName = chainId === 1 ? "ethereum" : chainId === 11155111 ? "sepolia" : chainId === 1337 || chainId === 31337 ? "hardhat" : void 0;
|
|
22083
23969
|
if (!chainName) {
|
|
@@ -22653,10 +24539,10 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22653
24539
|
"function allowance(address owner, address spender) view returns (uint256)",
|
|
22654
24540
|
"function approve(address spender, uint256 amount) returns (bool)"
|
|
22655
24541
|
];
|
|
22656
|
-
const stablecoin = new
|
|
24542
|
+
const stablecoin = new import_ethers17.Contract(params.stablecoinAddress, erc20Abi, params.signer);
|
|
22657
24543
|
const allowance = await stablecoin.allowance(signerAddress, psmAddress);
|
|
22658
24544
|
if (allowance < params.amountWei) {
|
|
22659
|
-
const approveTx = await stablecoin.approve(psmAddress,
|
|
24545
|
+
const approveTx = await stablecoin.approve(psmAddress, import_ethers17.MaxUint256);
|
|
22660
24546
|
await approveTx.wait();
|
|
22661
24547
|
}
|
|
22662
24548
|
const psm = SimplePSMV2__factory.connect(psmAddress, params.signer);
|
|
@@ -22691,10 +24577,10 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22691
24577
|
"function allowance(address owner, address spender) view returns (uint256)",
|
|
22692
24578
|
"function approve(address spender, uint256 amount) returns (bool)"
|
|
22693
24579
|
];
|
|
22694
|
-
const ucdToken = new
|
|
24580
|
+
const ucdToken = new import_ethers17.Contract(ucdAddress, erc20Abi, params.signer);
|
|
22695
24581
|
const allowance = await ucdToken.allowance(signerAddress, ucdControllerAddress);
|
|
22696
24582
|
if (allowance < params.ucdAmountWei) {
|
|
22697
|
-
const approveTx = await ucdToken.approve(ucdControllerAddress,
|
|
24583
|
+
const approveTx = await ucdToken.approve(ucdControllerAddress, import_ethers17.MaxUint256);
|
|
22698
24584
|
await approveTx.wait();
|
|
22699
24585
|
}
|
|
22700
24586
|
const psm = SimplePSMV2__factory.connect(psmAddress, params.signer);
|
|
@@ -22713,6 +24599,132 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22713
24599
|
* @throws if timeout is reached before subgraph catches up
|
|
22714
24600
|
*/
|
|
22715
24601
|
// ============================================================================
|
|
24602
|
+
// HIGH-LEVEL API - Agent Delegation (auto-renew) — SEPOLIA ONLY
|
|
24603
|
+
// ============================================================================
|
|
24604
|
+
/** Guard: the AgentDelegationRegistry MVP is deployed on Sepolia only. */
|
|
24605
|
+
async assertAgentDelegationSepolia() {
|
|
24606
|
+
const chainId = Number((await this.getProviderOrThrow().getNetwork()).chainId);
|
|
24607
|
+
if (chainId !== 11155111) {
|
|
24608
|
+
throw new SDKError({
|
|
24609
|
+
message: `Agent auto-renew delegation is Sepolia-only (chainId 11155111); got ${chainId}`,
|
|
24610
|
+
category: "NETWORK" /* NETWORK */,
|
|
24611
|
+
severity: "HIGH" /* HIGH */
|
|
24612
|
+
});
|
|
24613
|
+
}
|
|
24614
|
+
const addr = this.config.contractAddresses?.agentDelegationRegistry;
|
|
24615
|
+
if (!addr) {
|
|
24616
|
+
throw new SDKError({
|
|
24617
|
+
message: "AgentDelegationRegistry address not configured \u2014 provide contractAddresses.agentDelegationRegistry",
|
|
24618
|
+
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
24619
|
+
severity: "HIGH" /* HIGH */
|
|
24620
|
+
});
|
|
24621
|
+
}
|
|
24622
|
+
return addr;
|
|
24623
|
+
}
|
|
24624
|
+
/**
|
|
24625
|
+
* Read a position's auto-renew delegation state (used to drive the Enable/Disable toggle).
|
|
24626
|
+
* Pure view — no signer required.
|
|
24627
|
+
*/
|
|
24628
|
+
async getAutoRenewStatus(positionId, user) {
|
|
24629
|
+
const addr = await this.assertAgentDelegationSepolia();
|
|
24630
|
+
const registry = AgentDelegationRegistry__factory.connect(addr, this.getProviderOrThrow());
|
|
24631
|
+
const pid = this.toBytes32(positionId);
|
|
24632
|
+
const grant = await registry.getLoanGrant(pid);
|
|
24633
|
+
const enabled = grant.borrower !== "0x0000000000000000000000000000000000000000" && (Number(grant.scopeBits) & 1) !== 0;
|
|
24634
|
+
const agentActive = user ? await registry.isAgentActive(user) : null;
|
|
24635
|
+
const canRenew = user ? await registry.canRenew(pid, user).then((r) => ({ ok: r.ok, reason: Number(r.reason) })) : null;
|
|
24636
|
+
return {
|
|
24637
|
+
enabled,
|
|
24638
|
+
borrower: grant.borrower,
|
|
24639
|
+
maxRenewals: Number(grant.maxRenewals),
|
|
24640
|
+
renewalsUsed: Number(grant.renewalsUsed),
|
|
24641
|
+
agentActive,
|
|
24642
|
+
canRenew
|
|
24643
|
+
};
|
|
24644
|
+
}
|
|
24645
|
+
/**
|
|
24646
|
+
* Enable auto-renew delegation for a position. Orchestrates the first-time setup: if the
|
|
24647
|
+
* borrower has no active agent, mints a fresh per-user agent PKP (via lit-ops-server) and
|
|
24648
|
+
* registers it, then records the position's renew grant. Borrower-signed.
|
|
24649
|
+
*/
|
|
24650
|
+
async enableAutoRenew(positionId, options) {
|
|
24651
|
+
const addr = await this.assertAgentDelegationSepolia();
|
|
24652
|
+
const pdrAddr = this.config.contractAddresses?.positionDelegateRegistry;
|
|
24653
|
+
if (!pdrAddr) {
|
|
24654
|
+
throw new SDKError({
|
|
24655
|
+
message: "PositionDelegateRegistry address not configured \u2014 required to authorize the renewal agent (contractAddresses.positionDelegateRegistry)",
|
|
24656
|
+
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
24657
|
+
severity: "HIGH" /* HIGH */
|
|
24658
|
+
});
|
|
24659
|
+
}
|
|
24660
|
+
const signer = this.getSignerOrThrow();
|
|
24661
|
+
const user = await signer.getAddress();
|
|
24662
|
+
const registry = AgentDelegationRegistry__factory.connect(addr, signer);
|
|
24663
|
+
const pid = this.toBytes32(positionId);
|
|
24664
|
+
let agentAddress;
|
|
24665
|
+
const hasActiveAgent = await registry.isAgentActive(user);
|
|
24666
|
+
if (hasActiveAgent) {
|
|
24667
|
+
agentAddress = (await registry.agentOf(user)).agent;
|
|
24668
|
+
} else {
|
|
24669
|
+
agentAddress = await mintAgentPkp({
|
|
24670
|
+
serviceEndpoint: this.config.serviceEndpoint,
|
|
24671
|
+
authHeader: this.serverSession ? () => this.serverSession.getAuthHeader() : void 0
|
|
24672
|
+
});
|
|
24673
|
+
const validitySeconds = options?.agentValiditySeconds ?? 90 * 24 * 60 * 60;
|
|
24674
|
+
const validUntil = Math.floor(Date.now() / 1e3) + validitySeconds;
|
|
24675
|
+
const regTx = await registry.registerAgent(user, agentAddress, validUntil);
|
|
24676
|
+
await regTx.wait();
|
|
24677
|
+
}
|
|
24678
|
+
const currentDelegate = await getPositionDelegate(pid, signer, pdrAddr).catch(
|
|
24679
|
+
() => null
|
|
24680
|
+
);
|
|
24681
|
+
if (!currentDelegate || currentDelegate.toLowerCase() !== agentAddress.toLowerCase()) {
|
|
24682
|
+
const delTx = await setPositionDelegate(pid, agentAddress, signer, pdrAddr);
|
|
24683
|
+
await delTx.wait();
|
|
24684
|
+
}
|
|
24685
|
+
const tx = await registry.enableAutoRenew(
|
|
24686
|
+
pid,
|
|
24687
|
+
options?.maxRenewals ?? 0,
|
|
24688
|
+
options?.maxEndTimestamp ?? 0
|
|
24689
|
+
);
|
|
24690
|
+
const receipt = await tx.wait();
|
|
24691
|
+
return { hash: tx.hash, blockNumber: receipt?.blockNumber ?? 0, agentAddress };
|
|
24692
|
+
}
|
|
24693
|
+
/** Disable auto-renew delegation for a position (clears the grant). Borrower-signed. */
|
|
24694
|
+
async disableAutoRenew(positionId) {
|
|
24695
|
+
const addr = await this.assertAgentDelegationSepolia();
|
|
24696
|
+
const signer = this.getSignerOrThrow();
|
|
24697
|
+
const user = await signer.getAddress();
|
|
24698
|
+
const registry = AgentDelegationRegistry__factory.connect(addr, signer);
|
|
24699
|
+
const pid = this.toBytes32(positionId);
|
|
24700
|
+
const pdrAddr = this.config.contractAddresses?.positionDelegateRegistry;
|
|
24701
|
+
if (!pdrAddr) {
|
|
24702
|
+
throw new SDKError({
|
|
24703
|
+
message: "PositionDelegateRegistry address not configured \u2014 required to clear the renewal agent's Gate-1 authorization (contractAddresses.positionDelegateRegistry)",
|
|
24704
|
+
category: "CONFIGURATION" /* CONFIGURATION */,
|
|
24705
|
+
severity: "HIGH" /* HIGH */
|
|
24706
|
+
});
|
|
24707
|
+
}
|
|
24708
|
+
{
|
|
24709
|
+
const [currentDelegate, userAgent] = await Promise.all([
|
|
24710
|
+
getPositionDelegate(pid, signer, pdrAddr).catch(() => null),
|
|
24711
|
+
registry.agentOf(user).then((a) => a.agent).catch(() => null)
|
|
24712
|
+
]);
|
|
24713
|
+
if (currentDelegate && userAgent && currentDelegate.toLowerCase() === userAgent.toLowerCase()) {
|
|
24714
|
+
const clearTx = await setPositionDelegate(
|
|
24715
|
+
pid,
|
|
24716
|
+
"0x0000000000000000000000000000000000000000",
|
|
24717
|
+
signer,
|
|
24718
|
+
pdrAddr
|
|
24719
|
+
);
|
|
24720
|
+
await clearTx.wait();
|
|
24721
|
+
}
|
|
24722
|
+
}
|
|
24723
|
+
const tx = await registry.disableAutoRenew(pid);
|
|
24724
|
+
const receipt = await tx.wait();
|
|
24725
|
+
return { hash: tx.hash, blockNumber: receipt?.blockNumber ?? 0 };
|
|
24726
|
+
}
|
|
24727
|
+
// ============================================================================
|
|
22716
24728
|
// HIGH-LEVEL API - Bitcoin Operations
|
|
22717
24729
|
// ============================================================================
|
|
22718
24730
|
/**
|
|
@@ -22906,7 +24918,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22906
24918
|
const maxUcdWhole = BigInt(result[3].toString());
|
|
22907
24919
|
return success({
|
|
22908
24920
|
liquidationThreshold: result[0].toString(),
|
|
22909
|
-
minimumLoanValueUcd: (0,
|
|
24921
|
+
minimumLoanValueUcd: (0, import_ethers17.formatUnits)(result[2], 18),
|
|
22910
24922
|
minimumLoanValueWei: result[2].toString(),
|
|
22911
24923
|
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
22912
24924
|
maxSingleLoanValueWei: (maxUcdWhole * 10n ** 18n).toString()
|
|
@@ -22943,7 +24955,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
22943
24955
|
const balanceWei = await provider.getBalance(address);
|
|
22944
24956
|
return success({
|
|
22945
24957
|
balanceWei: balanceWei.toString(),
|
|
22946
|
-
balanceEth: (0,
|
|
24958
|
+
balanceEth: (0, import_ethers17.formatEther)(balanceWei)
|
|
22947
24959
|
});
|
|
22948
24960
|
} catch (error) {
|
|
22949
24961
|
return failure(new SDKError({
|
|
@@ -23333,7 +25345,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23333
25345
|
* Convert decimal position ID to bytes32 format
|
|
23334
25346
|
*/
|
|
23335
25347
|
toBytes32(value) {
|
|
23336
|
-
return (0,
|
|
25348
|
+
return (0, import_ethers17.zeroPadValue)((0, import_ethers17.toBeHex)(BigInt(value)), 32);
|
|
23337
25349
|
}
|
|
23338
25350
|
/**
|
|
23339
25351
|
* Check if an error indicates a technical failure vs business logic rejection
|
|
@@ -23374,7 +25386,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23374
25386
|
const coreModuleAbi = [
|
|
23375
25387
|
"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))"
|
|
23376
25388
|
];
|
|
23377
|
-
const coreModule = new
|
|
25389
|
+
const coreModule = new import_ethers17.Contract(
|
|
23378
25390
|
coreModuleAddress,
|
|
23379
25391
|
coreModuleAbi,
|
|
23380
25392
|
provider
|
|
@@ -23441,7 +25453,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23441
25453
|
const corePositionAbi = [
|
|
23442
25454
|
"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))"
|
|
23443
25455
|
];
|
|
23444
|
-
const corePositionContract = new
|
|
25456
|
+
const corePositionContract = new import_ethers17.Contract(
|
|
23445
25457
|
coreAddress,
|
|
23446
25458
|
corePositionAbi,
|
|
23447
25459
|
provider
|
|
@@ -23452,7 +25464,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23452
25464
|
positionIdBytes32
|
|
23453
25465
|
);
|
|
23454
25466
|
const positionIdFromCore = corePosition?.positionId || corePosition?.[0] || null;
|
|
23455
|
-
if (positionIdFromCore && positionIdFromCore !==
|
|
25467
|
+
if (positionIdFromCore && positionIdFromCore !== import_ethers17.ZeroHash && positionIdFromCore !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
23456
25468
|
if (this.config.debug) {
|
|
23457
25469
|
log.info("Position exists in core contract", {
|
|
23458
25470
|
positionId,
|
|
@@ -23520,7 +25532,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23520
25532
|
throw new Error("loanOperationsManager address not configured");
|
|
23521
25533
|
}
|
|
23522
25534
|
const runner = this.config.contractSigner || this.getProviderOrThrow();
|
|
23523
|
-
const contract = new
|
|
25535
|
+
const contract = new import_ethers17.Contract(
|
|
23524
25536
|
addr.loanOperationsManager,
|
|
23525
25537
|
[
|
|
23526
25538
|
"function getProtocolConfig() external view returns (uint256 liquidationThreshold, uint256 minimumLoanValueUcd, uint256 minimumLoanValueWei, uint256 maxSingleLoanValueUcd)"
|
|
@@ -23533,7 +25545,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23533
25545
|
const maxUcdWhole = BigInt(result[3].toString());
|
|
23534
25546
|
return {
|
|
23535
25547
|
liquidationThreshold: result[0].toString(),
|
|
23536
|
-
minimumLoanValueUcd: (0,
|
|
25548
|
+
minimumLoanValueUcd: (0, import_ethers17.formatUnits)(result[2], 18),
|
|
23537
25549
|
minimumLoanValueWei: result[2].toString(),
|
|
23538
25550
|
maxSingleLoanValueUcd: maxUcdWhole.toString(),
|
|
23539
25551
|
maxSingleLoanValueWei: (maxUcdWhole * 10n ** 18n).toString()
|
|
@@ -23551,8 +25563,8 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23551
25563
|
const MIN_REVEAL_DELAY = 60;
|
|
23552
25564
|
const MAX_RANDOM_DELAY = 240;
|
|
23553
25565
|
const entropyInput = positionId + quantumTimestamp.toString();
|
|
23554
|
-
const hash = (0,
|
|
23555
|
-
(0,
|
|
25566
|
+
const hash = (0, import_ethers17.keccak256)(
|
|
25567
|
+
(0, import_ethers17.toUtf8Bytes)(entropyInput)
|
|
23556
25568
|
);
|
|
23557
25569
|
const randomValue = BigInt(hash);
|
|
23558
25570
|
const randomDelay = Number(randomValue % BigInt(MAX_RANDOM_DELAY));
|
|
@@ -23577,12 +25589,12 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23577
25589
|
const rawPositionId = /^0x/i.test(params.positionId.trim()) ? params.positionId.trim().slice(2) : params.positionId.trim();
|
|
23578
25590
|
const canonicalPositionId = "0x" + rawPositionId.padStart(64, "0").toLowerCase();
|
|
23579
25591
|
const intentTimestamp = Math.floor(Date.now() / 1e3);
|
|
23580
|
-
const intentActionHash = (0,
|
|
23581
|
-
const intentHash = (0,
|
|
25592
|
+
const intentActionHash = (0, import_ethers17.keccak256)((0, import_ethers17.toUtf8Bytes)("liquidate-position"));
|
|
25593
|
+
const intentHash = (0, import_ethers17.solidityPackedKeccak256)(
|
|
23582
25594
|
["bytes32", "uint256", "uint256", "address", "bytes32"],
|
|
23583
25595
|
[canonicalPositionId, intentTimestamp, chainId, intentSigner, intentActionHash]
|
|
23584
25596
|
);
|
|
23585
|
-
const intentSignature = await signer.signMessage((0,
|
|
25597
|
+
const intentSignature = await signer.signMessage((0, import_ethers17.getBytes)(intentHash));
|
|
23586
25598
|
const response = await fetch(endpoint, {
|
|
23587
25599
|
method: "POST",
|
|
23588
25600
|
headers: { "Content-Type": "application/json" },
|
|
@@ -23634,7 +25646,7 @@ Message: ${causeMessage}${quantumContext}${mintDebtDiagnostics}`
|
|
|
23634
25646
|
const vrfSeedRaw = await lmResult.value["vrfSeeds"](positionId);
|
|
23635
25647
|
const vrfSeed = BigInt(vrfSeedRaw.toString());
|
|
23636
25648
|
if (vrfSeed !== 0n) {
|
|
23637
|
-
const finalEntropy = (0,
|
|
25649
|
+
const finalEntropy = (0, import_ethers17.solidityPackedKeccak256)(
|
|
23638
25650
|
["uint256", "uint256", "bytes32"],
|
|
23639
25651
|
[vrfSeed, BigInt(quantumTimestamp.toString()), positionId]
|
|
23640
25652
|
);
|
|
@@ -23910,30 +25922,6 @@ var EventHelpers = {
|
|
|
23910
25922
|
});
|
|
23911
25923
|
}
|
|
23912
25924
|
};
|
|
23913
|
-
|
|
23914
|
-
// src/utils/position-delegate.utils.ts
|
|
23915
|
-
var import_ethers16 = require("ethers");
|
|
23916
|
-
var POSITION_DELEGATE_REGISTRY_ABI = [
|
|
23917
|
-
"function positionDelegate(bytes32 positionId) view returns (address)",
|
|
23918
|
-
"function setPositionDelegate(bytes32 positionId, address newDelegate) external",
|
|
23919
|
-
"event PositionDelegateUpdated(bytes32 indexed positionId, address indexed oldDelegate, address indexed newDelegate)"
|
|
23920
|
-
];
|
|
23921
|
-
async function setPositionDelegate(positionId, delegate, signer, registryAddress) {
|
|
23922
|
-
const registry = new import_ethers16.Contract(
|
|
23923
|
-
registryAddress,
|
|
23924
|
-
POSITION_DELEGATE_REGISTRY_ABI,
|
|
23925
|
-
signer
|
|
23926
|
-
);
|
|
23927
|
-
return registry["setPositionDelegate"](positionId, delegate);
|
|
23928
|
-
}
|
|
23929
|
-
async function getPositionDelegate(positionId, provider, registryAddress) {
|
|
23930
|
-
const registry = new import_ethers16.Contract(
|
|
23931
|
-
registryAddress,
|
|
23932
|
-
POSITION_DELEGATE_REGISTRY_ABI,
|
|
23933
|
-
provider
|
|
23934
|
-
);
|
|
23935
|
-
return registry["positionDelegate"](positionId);
|
|
23936
|
-
}
|
|
23937
25925
|
// Annotate the CommonJS export names for ESM import in node:
|
|
23938
25926
|
0 && (module.exports = {
|
|
23939
25927
|
ALL_CONTRACTS,
|