@defisaver/positions-sdk 2.1.16 → 2.1.17
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/CLAUDE.md +32 -0
- package/cjs/config/contracts.d.ts +12 -0
- package/cjs/config/contracts.js +7 -3
- package/cjs/contracts.d.ts +100947 -134653
- package/cjs/fluid/index.js +116 -38
- package/cjs/markets/fluid/index.d.ts +46 -0
- package/cjs/markets/fluid/index.js +436 -1
- package/cjs/portfolio/index.js +4 -1
- package/cjs/services/priceService.d.ts +489 -0
- package/cjs/services/priceService.js +111 -2
- package/cjs/services/viem.d.ts +2 -3254
- package/cjs/types/fluid.d.ts +30 -1
- package/cjs/types/fluid.js +31 -1
- package/esm/config/contracts.d.ts +12 -0
- package/esm/config/contracts.js +7 -3
- package/esm/contracts.d.ts +100947 -134653
- package/esm/fluid/index.js +118 -40
- package/esm/markets/fluid/index.d.ts +46 -0
- package/esm/markets/fluid/index.js +415 -1
- package/esm/portfolio/index.js +4 -1
- package/esm/services/priceService.d.ts +489 -0
- package/esm/services/priceService.js +102 -2
- package/esm/services/viem.d.ts +2 -3254
- package/esm/types/fluid.d.ts +30 -1
- package/esm/types/fluid.js +30 -0
- package/package.json +2 -2
- package/src/config/contracts.ts +7 -3
- package/src/fluid/index.ts +153 -47
- package/src/markets/fluid/index.ts +442 -2
- package/src/portfolio/index.ts +3 -1
- package/src/services/priceService.ts +123 -4
- package/src/types/fluid.ts +32 -1
|
@@ -6,6 +6,9 @@ export declare const getUSDCPrice: (client: Client) => Promise<string>;
|
|
|
6
6
|
export declare const getCompPrice: (client: Client) => Promise<string>;
|
|
7
7
|
export declare const getWstETHPrice: (client: Client, network?: NetworkNumber) => Promise<string>;
|
|
8
8
|
export declare const getWeETHPrice: (client: Client, network?: NetworkNumber) => Promise<string>;
|
|
9
|
+
export declare const getWsrETHPrice: (client: Client, network?: NetworkNumber) => Promise<string>;
|
|
10
|
+
export declare const getSyrupUSDTPrice: (client: Client, network?: NetworkNumber) => Promise<string>;
|
|
11
|
+
export declare const getWstUSRPrice: (client: Client, network?: NetworkNumber) => Promise<string>;
|
|
9
12
|
export declare const getWstETHChainLinkPriceCalls: (client: PublicClient, network: NetworkNumber) => ({
|
|
10
13
|
address: `0x${string}`;
|
|
11
14
|
abi: readonly [{
|
|
@@ -1324,10 +1327,496 @@ export declare const getWeETHChainLinkPriceCalls: (client: PublicClient, network
|
|
|
1324
1327
|
functionName: string;
|
|
1325
1328
|
args: never[];
|
|
1326
1329
|
})[];
|
|
1330
|
+
export declare const getWsrETHChainLinkPriceCalls: (client: PublicClient, network: NetworkNumber) => {
|
|
1331
|
+
address: `0x${string}`;
|
|
1332
|
+
abi: readonly [{
|
|
1333
|
+
readonly inputs: readonly [];
|
|
1334
|
+
readonly name: "NonContractCall";
|
|
1335
|
+
readonly type: "error";
|
|
1336
|
+
}, {
|
|
1337
|
+
readonly inputs: readonly [];
|
|
1338
|
+
readonly name: "SenderNotAdmin";
|
|
1339
|
+
readonly type: "error";
|
|
1340
|
+
}, {
|
|
1341
|
+
readonly inputs: readonly [];
|
|
1342
|
+
readonly name: "SenderNotOwner";
|
|
1343
|
+
readonly type: "error";
|
|
1344
|
+
}, {
|
|
1345
|
+
readonly inputs: readonly [];
|
|
1346
|
+
readonly name: "adminVault";
|
|
1347
|
+
readonly outputs: readonly [{
|
|
1348
|
+
readonly internalType: "contract AdminVault";
|
|
1349
|
+
readonly name: "";
|
|
1350
|
+
readonly type: "address";
|
|
1351
|
+
}];
|
|
1352
|
+
readonly stateMutability: "view";
|
|
1353
|
+
readonly type: "function";
|
|
1354
|
+
}, {
|
|
1355
|
+
readonly inputs: readonly [{
|
|
1356
|
+
readonly internalType: "address";
|
|
1357
|
+
readonly name: "";
|
|
1358
|
+
readonly type: "address";
|
|
1359
|
+
}, {
|
|
1360
|
+
readonly internalType: "address";
|
|
1361
|
+
readonly name: "";
|
|
1362
|
+
readonly type: "address";
|
|
1363
|
+
}];
|
|
1364
|
+
readonly name: "aggregators";
|
|
1365
|
+
readonly outputs: readonly [{
|
|
1366
|
+
readonly internalType: "address";
|
|
1367
|
+
readonly name: "";
|
|
1368
|
+
readonly type: "address";
|
|
1369
|
+
}];
|
|
1370
|
+
readonly stateMutability: "view";
|
|
1371
|
+
readonly type: "function";
|
|
1372
|
+
}, {
|
|
1373
|
+
readonly inputs: readonly [{
|
|
1374
|
+
readonly internalType: "address";
|
|
1375
|
+
readonly name: "base";
|
|
1376
|
+
readonly type: "address";
|
|
1377
|
+
}, {
|
|
1378
|
+
readonly internalType: "address";
|
|
1379
|
+
readonly name: "quote";
|
|
1380
|
+
readonly type: "address";
|
|
1381
|
+
}];
|
|
1382
|
+
readonly name: "getFeed";
|
|
1383
|
+
readonly outputs: readonly [{
|
|
1384
|
+
readonly internalType: "address";
|
|
1385
|
+
readonly name: "aggregator";
|
|
1386
|
+
readonly type: "address";
|
|
1387
|
+
}];
|
|
1388
|
+
readonly stateMutability: "view";
|
|
1389
|
+
readonly type: "function";
|
|
1390
|
+
}, {
|
|
1391
|
+
readonly inputs: readonly [];
|
|
1392
|
+
readonly name: "kill";
|
|
1393
|
+
readonly outputs: readonly [];
|
|
1394
|
+
readonly stateMutability: "nonpayable";
|
|
1395
|
+
readonly type: "function";
|
|
1396
|
+
}, {
|
|
1397
|
+
readonly inputs: readonly [{
|
|
1398
|
+
readonly internalType: "address";
|
|
1399
|
+
readonly name: "base";
|
|
1400
|
+
readonly type: "address";
|
|
1401
|
+
}, {
|
|
1402
|
+
readonly internalType: "address";
|
|
1403
|
+
readonly name: "quote";
|
|
1404
|
+
readonly type: "address";
|
|
1405
|
+
}];
|
|
1406
|
+
readonly name: "latestRoundData";
|
|
1407
|
+
readonly outputs: readonly [{
|
|
1408
|
+
readonly internalType: "uint80";
|
|
1409
|
+
readonly name: "roundId";
|
|
1410
|
+
readonly type: "uint80";
|
|
1411
|
+
}, {
|
|
1412
|
+
readonly internalType: "int256";
|
|
1413
|
+
readonly name: "answer";
|
|
1414
|
+
readonly type: "int256";
|
|
1415
|
+
}, {
|
|
1416
|
+
readonly internalType: "uint256";
|
|
1417
|
+
readonly name: "startedAt";
|
|
1418
|
+
readonly type: "uint256";
|
|
1419
|
+
}, {
|
|
1420
|
+
readonly internalType: "uint256";
|
|
1421
|
+
readonly name: "updatedAt";
|
|
1422
|
+
readonly type: "uint256";
|
|
1423
|
+
}, {
|
|
1424
|
+
readonly internalType: "uint80";
|
|
1425
|
+
readonly name: "answeredInRound";
|
|
1426
|
+
readonly type: "uint80";
|
|
1427
|
+
}];
|
|
1428
|
+
readonly stateMutability: "view";
|
|
1429
|
+
readonly type: "function";
|
|
1430
|
+
}, {
|
|
1431
|
+
readonly inputs: readonly [{
|
|
1432
|
+
readonly internalType: "address";
|
|
1433
|
+
readonly name: "base";
|
|
1434
|
+
readonly type: "address";
|
|
1435
|
+
}, {
|
|
1436
|
+
readonly internalType: "address";
|
|
1437
|
+
readonly name: "quote";
|
|
1438
|
+
readonly type: "address";
|
|
1439
|
+
}, {
|
|
1440
|
+
readonly internalType: "address";
|
|
1441
|
+
readonly name: "aggregator";
|
|
1442
|
+
readonly type: "address";
|
|
1443
|
+
}];
|
|
1444
|
+
readonly name: "setFeed";
|
|
1445
|
+
readonly outputs: readonly [];
|
|
1446
|
+
readonly stateMutability: "nonpayable";
|
|
1447
|
+
readonly type: "function";
|
|
1448
|
+
}, {
|
|
1449
|
+
readonly inputs: readonly [{
|
|
1450
|
+
readonly internalType: "address[]";
|
|
1451
|
+
readonly name: "bases";
|
|
1452
|
+
readonly type: "address[]";
|
|
1453
|
+
}, {
|
|
1454
|
+
readonly internalType: "address[]";
|
|
1455
|
+
readonly name: "quotes";
|
|
1456
|
+
readonly type: "address[]";
|
|
1457
|
+
}, {
|
|
1458
|
+
readonly internalType: "address[]";
|
|
1459
|
+
readonly name: "aggregator";
|
|
1460
|
+
readonly type: "address[]";
|
|
1461
|
+
}];
|
|
1462
|
+
readonly name: "setFeeds";
|
|
1463
|
+
readonly outputs: readonly [];
|
|
1464
|
+
readonly stateMutability: "nonpayable";
|
|
1465
|
+
readonly type: "function";
|
|
1466
|
+
}, {
|
|
1467
|
+
readonly inputs: readonly [{
|
|
1468
|
+
readonly internalType: "address";
|
|
1469
|
+
readonly name: "_token";
|
|
1470
|
+
readonly type: "address";
|
|
1471
|
+
}, {
|
|
1472
|
+
readonly internalType: "address";
|
|
1473
|
+
readonly name: "_receiver";
|
|
1474
|
+
readonly type: "address";
|
|
1475
|
+
}, {
|
|
1476
|
+
readonly internalType: "uint256";
|
|
1477
|
+
readonly name: "_amount";
|
|
1478
|
+
readonly type: "uint256";
|
|
1479
|
+
}];
|
|
1480
|
+
readonly name: "withdrawStuckFunds";
|
|
1481
|
+
readonly outputs: readonly [];
|
|
1482
|
+
readonly stateMutability: "nonpayable";
|
|
1483
|
+
readonly type: "function";
|
|
1484
|
+
}];
|
|
1485
|
+
functionName: string;
|
|
1486
|
+
args: string[];
|
|
1487
|
+
}[];
|
|
1488
|
+
export declare const getSyrupUSDTChainLinkPriceCalls: (client: PublicClient, network: NetworkNumber) => {
|
|
1489
|
+
address: `0x${string}`;
|
|
1490
|
+
abi: readonly [{
|
|
1491
|
+
readonly inputs: readonly [];
|
|
1492
|
+
readonly name: "NonContractCall";
|
|
1493
|
+
readonly type: "error";
|
|
1494
|
+
}, {
|
|
1495
|
+
readonly inputs: readonly [];
|
|
1496
|
+
readonly name: "SenderNotAdmin";
|
|
1497
|
+
readonly type: "error";
|
|
1498
|
+
}, {
|
|
1499
|
+
readonly inputs: readonly [];
|
|
1500
|
+
readonly name: "SenderNotOwner";
|
|
1501
|
+
readonly type: "error";
|
|
1502
|
+
}, {
|
|
1503
|
+
readonly inputs: readonly [];
|
|
1504
|
+
readonly name: "adminVault";
|
|
1505
|
+
readonly outputs: readonly [{
|
|
1506
|
+
readonly internalType: "contract AdminVault";
|
|
1507
|
+
readonly name: "";
|
|
1508
|
+
readonly type: "address";
|
|
1509
|
+
}];
|
|
1510
|
+
readonly stateMutability: "view";
|
|
1511
|
+
readonly type: "function";
|
|
1512
|
+
}, {
|
|
1513
|
+
readonly inputs: readonly [{
|
|
1514
|
+
readonly internalType: "address";
|
|
1515
|
+
readonly name: "";
|
|
1516
|
+
readonly type: "address";
|
|
1517
|
+
}, {
|
|
1518
|
+
readonly internalType: "address";
|
|
1519
|
+
readonly name: "";
|
|
1520
|
+
readonly type: "address";
|
|
1521
|
+
}];
|
|
1522
|
+
readonly name: "aggregators";
|
|
1523
|
+
readonly outputs: readonly [{
|
|
1524
|
+
readonly internalType: "address";
|
|
1525
|
+
readonly name: "";
|
|
1526
|
+
readonly type: "address";
|
|
1527
|
+
}];
|
|
1528
|
+
readonly stateMutability: "view";
|
|
1529
|
+
readonly type: "function";
|
|
1530
|
+
}, {
|
|
1531
|
+
readonly inputs: readonly [{
|
|
1532
|
+
readonly internalType: "address";
|
|
1533
|
+
readonly name: "base";
|
|
1534
|
+
readonly type: "address";
|
|
1535
|
+
}, {
|
|
1536
|
+
readonly internalType: "address";
|
|
1537
|
+
readonly name: "quote";
|
|
1538
|
+
readonly type: "address";
|
|
1539
|
+
}];
|
|
1540
|
+
readonly name: "getFeed";
|
|
1541
|
+
readonly outputs: readonly [{
|
|
1542
|
+
readonly internalType: "address";
|
|
1543
|
+
readonly name: "aggregator";
|
|
1544
|
+
readonly type: "address";
|
|
1545
|
+
}];
|
|
1546
|
+
readonly stateMutability: "view";
|
|
1547
|
+
readonly type: "function";
|
|
1548
|
+
}, {
|
|
1549
|
+
readonly inputs: readonly [];
|
|
1550
|
+
readonly name: "kill";
|
|
1551
|
+
readonly outputs: readonly [];
|
|
1552
|
+
readonly stateMutability: "nonpayable";
|
|
1553
|
+
readonly type: "function";
|
|
1554
|
+
}, {
|
|
1555
|
+
readonly inputs: readonly [{
|
|
1556
|
+
readonly internalType: "address";
|
|
1557
|
+
readonly name: "base";
|
|
1558
|
+
readonly type: "address";
|
|
1559
|
+
}, {
|
|
1560
|
+
readonly internalType: "address";
|
|
1561
|
+
readonly name: "quote";
|
|
1562
|
+
readonly type: "address";
|
|
1563
|
+
}];
|
|
1564
|
+
readonly name: "latestRoundData";
|
|
1565
|
+
readonly outputs: readonly [{
|
|
1566
|
+
readonly internalType: "uint80";
|
|
1567
|
+
readonly name: "roundId";
|
|
1568
|
+
readonly type: "uint80";
|
|
1569
|
+
}, {
|
|
1570
|
+
readonly internalType: "int256";
|
|
1571
|
+
readonly name: "answer";
|
|
1572
|
+
readonly type: "int256";
|
|
1573
|
+
}, {
|
|
1574
|
+
readonly internalType: "uint256";
|
|
1575
|
+
readonly name: "startedAt";
|
|
1576
|
+
readonly type: "uint256";
|
|
1577
|
+
}, {
|
|
1578
|
+
readonly internalType: "uint256";
|
|
1579
|
+
readonly name: "updatedAt";
|
|
1580
|
+
readonly type: "uint256";
|
|
1581
|
+
}, {
|
|
1582
|
+
readonly internalType: "uint80";
|
|
1583
|
+
readonly name: "answeredInRound";
|
|
1584
|
+
readonly type: "uint80";
|
|
1585
|
+
}];
|
|
1586
|
+
readonly stateMutability: "view";
|
|
1587
|
+
readonly type: "function";
|
|
1588
|
+
}, {
|
|
1589
|
+
readonly inputs: readonly [{
|
|
1590
|
+
readonly internalType: "address";
|
|
1591
|
+
readonly name: "base";
|
|
1592
|
+
readonly type: "address";
|
|
1593
|
+
}, {
|
|
1594
|
+
readonly internalType: "address";
|
|
1595
|
+
readonly name: "quote";
|
|
1596
|
+
readonly type: "address";
|
|
1597
|
+
}, {
|
|
1598
|
+
readonly internalType: "address";
|
|
1599
|
+
readonly name: "aggregator";
|
|
1600
|
+
readonly type: "address";
|
|
1601
|
+
}];
|
|
1602
|
+
readonly name: "setFeed";
|
|
1603
|
+
readonly outputs: readonly [];
|
|
1604
|
+
readonly stateMutability: "nonpayable";
|
|
1605
|
+
readonly type: "function";
|
|
1606
|
+
}, {
|
|
1607
|
+
readonly inputs: readonly [{
|
|
1608
|
+
readonly internalType: "address[]";
|
|
1609
|
+
readonly name: "bases";
|
|
1610
|
+
readonly type: "address[]";
|
|
1611
|
+
}, {
|
|
1612
|
+
readonly internalType: "address[]";
|
|
1613
|
+
readonly name: "quotes";
|
|
1614
|
+
readonly type: "address[]";
|
|
1615
|
+
}, {
|
|
1616
|
+
readonly internalType: "address[]";
|
|
1617
|
+
readonly name: "aggregator";
|
|
1618
|
+
readonly type: "address[]";
|
|
1619
|
+
}];
|
|
1620
|
+
readonly name: "setFeeds";
|
|
1621
|
+
readonly outputs: readonly [];
|
|
1622
|
+
readonly stateMutability: "nonpayable";
|
|
1623
|
+
readonly type: "function";
|
|
1624
|
+
}, {
|
|
1625
|
+
readonly inputs: readonly [{
|
|
1626
|
+
readonly internalType: "address";
|
|
1627
|
+
readonly name: "_token";
|
|
1628
|
+
readonly type: "address";
|
|
1629
|
+
}, {
|
|
1630
|
+
readonly internalType: "address";
|
|
1631
|
+
readonly name: "_receiver";
|
|
1632
|
+
readonly type: "address";
|
|
1633
|
+
}, {
|
|
1634
|
+
readonly internalType: "uint256";
|
|
1635
|
+
readonly name: "_amount";
|
|
1636
|
+
readonly type: "uint256";
|
|
1637
|
+
}];
|
|
1638
|
+
readonly name: "withdrawStuckFunds";
|
|
1639
|
+
readonly outputs: readonly [];
|
|
1640
|
+
readonly stateMutability: "nonpayable";
|
|
1641
|
+
readonly type: "function";
|
|
1642
|
+
}];
|
|
1643
|
+
functionName: string;
|
|
1644
|
+
args: string[];
|
|
1645
|
+
}[];
|
|
1646
|
+
export declare const getWstUSRChainLinkPriceCalls: (client: PublicClient, network: NetworkNumber) => {
|
|
1647
|
+
address: `0x${string}`;
|
|
1648
|
+
abi: readonly [{
|
|
1649
|
+
readonly inputs: readonly [];
|
|
1650
|
+
readonly name: "NonContractCall";
|
|
1651
|
+
readonly type: "error";
|
|
1652
|
+
}, {
|
|
1653
|
+
readonly inputs: readonly [];
|
|
1654
|
+
readonly name: "SenderNotAdmin";
|
|
1655
|
+
readonly type: "error";
|
|
1656
|
+
}, {
|
|
1657
|
+
readonly inputs: readonly [];
|
|
1658
|
+
readonly name: "SenderNotOwner";
|
|
1659
|
+
readonly type: "error";
|
|
1660
|
+
}, {
|
|
1661
|
+
readonly inputs: readonly [];
|
|
1662
|
+
readonly name: "adminVault";
|
|
1663
|
+
readonly outputs: readonly [{
|
|
1664
|
+
readonly internalType: "contract AdminVault";
|
|
1665
|
+
readonly name: "";
|
|
1666
|
+
readonly type: "address";
|
|
1667
|
+
}];
|
|
1668
|
+
readonly stateMutability: "view";
|
|
1669
|
+
readonly type: "function";
|
|
1670
|
+
}, {
|
|
1671
|
+
readonly inputs: readonly [{
|
|
1672
|
+
readonly internalType: "address";
|
|
1673
|
+
readonly name: "";
|
|
1674
|
+
readonly type: "address";
|
|
1675
|
+
}, {
|
|
1676
|
+
readonly internalType: "address";
|
|
1677
|
+
readonly name: "";
|
|
1678
|
+
readonly type: "address";
|
|
1679
|
+
}];
|
|
1680
|
+
readonly name: "aggregators";
|
|
1681
|
+
readonly outputs: readonly [{
|
|
1682
|
+
readonly internalType: "address";
|
|
1683
|
+
readonly name: "";
|
|
1684
|
+
readonly type: "address";
|
|
1685
|
+
}];
|
|
1686
|
+
readonly stateMutability: "view";
|
|
1687
|
+
readonly type: "function";
|
|
1688
|
+
}, {
|
|
1689
|
+
readonly inputs: readonly [{
|
|
1690
|
+
readonly internalType: "address";
|
|
1691
|
+
readonly name: "base";
|
|
1692
|
+
readonly type: "address";
|
|
1693
|
+
}, {
|
|
1694
|
+
readonly internalType: "address";
|
|
1695
|
+
readonly name: "quote";
|
|
1696
|
+
readonly type: "address";
|
|
1697
|
+
}];
|
|
1698
|
+
readonly name: "getFeed";
|
|
1699
|
+
readonly outputs: readonly [{
|
|
1700
|
+
readonly internalType: "address";
|
|
1701
|
+
readonly name: "aggregator";
|
|
1702
|
+
readonly type: "address";
|
|
1703
|
+
}];
|
|
1704
|
+
readonly stateMutability: "view";
|
|
1705
|
+
readonly type: "function";
|
|
1706
|
+
}, {
|
|
1707
|
+
readonly inputs: readonly [];
|
|
1708
|
+
readonly name: "kill";
|
|
1709
|
+
readonly outputs: readonly [];
|
|
1710
|
+
readonly stateMutability: "nonpayable";
|
|
1711
|
+
readonly type: "function";
|
|
1712
|
+
}, {
|
|
1713
|
+
readonly inputs: readonly [{
|
|
1714
|
+
readonly internalType: "address";
|
|
1715
|
+
readonly name: "base";
|
|
1716
|
+
readonly type: "address";
|
|
1717
|
+
}, {
|
|
1718
|
+
readonly internalType: "address";
|
|
1719
|
+
readonly name: "quote";
|
|
1720
|
+
readonly type: "address";
|
|
1721
|
+
}];
|
|
1722
|
+
readonly name: "latestRoundData";
|
|
1723
|
+
readonly outputs: readonly [{
|
|
1724
|
+
readonly internalType: "uint80";
|
|
1725
|
+
readonly name: "roundId";
|
|
1726
|
+
readonly type: "uint80";
|
|
1727
|
+
}, {
|
|
1728
|
+
readonly internalType: "int256";
|
|
1729
|
+
readonly name: "answer";
|
|
1730
|
+
readonly type: "int256";
|
|
1731
|
+
}, {
|
|
1732
|
+
readonly internalType: "uint256";
|
|
1733
|
+
readonly name: "startedAt";
|
|
1734
|
+
readonly type: "uint256";
|
|
1735
|
+
}, {
|
|
1736
|
+
readonly internalType: "uint256";
|
|
1737
|
+
readonly name: "updatedAt";
|
|
1738
|
+
readonly type: "uint256";
|
|
1739
|
+
}, {
|
|
1740
|
+
readonly internalType: "uint80";
|
|
1741
|
+
readonly name: "answeredInRound";
|
|
1742
|
+
readonly type: "uint80";
|
|
1743
|
+
}];
|
|
1744
|
+
readonly stateMutability: "view";
|
|
1745
|
+
readonly type: "function";
|
|
1746
|
+
}, {
|
|
1747
|
+
readonly inputs: readonly [{
|
|
1748
|
+
readonly internalType: "address";
|
|
1749
|
+
readonly name: "base";
|
|
1750
|
+
readonly type: "address";
|
|
1751
|
+
}, {
|
|
1752
|
+
readonly internalType: "address";
|
|
1753
|
+
readonly name: "quote";
|
|
1754
|
+
readonly type: "address";
|
|
1755
|
+
}, {
|
|
1756
|
+
readonly internalType: "address";
|
|
1757
|
+
readonly name: "aggregator";
|
|
1758
|
+
readonly type: "address";
|
|
1759
|
+
}];
|
|
1760
|
+
readonly name: "setFeed";
|
|
1761
|
+
readonly outputs: readonly [];
|
|
1762
|
+
readonly stateMutability: "nonpayable";
|
|
1763
|
+
readonly type: "function";
|
|
1764
|
+
}, {
|
|
1765
|
+
readonly inputs: readonly [{
|
|
1766
|
+
readonly internalType: "address[]";
|
|
1767
|
+
readonly name: "bases";
|
|
1768
|
+
readonly type: "address[]";
|
|
1769
|
+
}, {
|
|
1770
|
+
readonly internalType: "address[]";
|
|
1771
|
+
readonly name: "quotes";
|
|
1772
|
+
readonly type: "address[]";
|
|
1773
|
+
}, {
|
|
1774
|
+
readonly internalType: "address[]";
|
|
1775
|
+
readonly name: "aggregator";
|
|
1776
|
+
readonly type: "address[]";
|
|
1777
|
+
}];
|
|
1778
|
+
readonly name: "setFeeds";
|
|
1779
|
+
readonly outputs: readonly [];
|
|
1780
|
+
readonly stateMutability: "nonpayable";
|
|
1781
|
+
readonly type: "function";
|
|
1782
|
+
}, {
|
|
1783
|
+
readonly inputs: readonly [{
|
|
1784
|
+
readonly internalType: "address";
|
|
1785
|
+
readonly name: "_token";
|
|
1786
|
+
readonly type: "address";
|
|
1787
|
+
}, {
|
|
1788
|
+
readonly internalType: "address";
|
|
1789
|
+
readonly name: "_receiver";
|
|
1790
|
+
readonly type: "address";
|
|
1791
|
+
}, {
|
|
1792
|
+
readonly internalType: "uint256";
|
|
1793
|
+
readonly name: "_amount";
|
|
1794
|
+
readonly type: "uint256";
|
|
1795
|
+
}];
|
|
1796
|
+
readonly name: "withdrawStuckFunds";
|
|
1797
|
+
readonly outputs: readonly [];
|
|
1798
|
+
readonly stateMutability: "nonpayable";
|
|
1799
|
+
readonly type: "function";
|
|
1800
|
+
}];
|
|
1801
|
+
functionName: string;
|
|
1802
|
+
args: string[];
|
|
1803
|
+
}[];
|
|
1327
1804
|
export declare const parseWstETHPriceCalls: (_ethPrice: string, wstETHrateAnswer: string, decimals: string) => {
|
|
1328
1805
|
ethPrice: Dec;
|
|
1329
1806
|
wstETHRate: string;
|
|
1330
1807
|
};
|
|
1808
|
+
export declare const parseWrsETHPriceCalls: (ethPriceAnswer: string, wrsETHrateAnswer: string) => {
|
|
1809
|
+
ethPrice: Dec;
|
|
1810
|
+
wrsETHRate: Dec;
|
|
1811
|
+
};
|
|
1812
|
+
export declare const parseSyrupUSDTPriceCalls: (usdtPriceAnswer: string, syrupUSDTRateAnswer: string) => {
|
|
1813
|
+
syrupUSDTRate: Dec;
|
|
1814
|
+
USDTRate: Dec;
|
|
1815
|
+
};
|
|
1816
|
+
export declare const parseWstUSRPriceCalls: (usrPrice: string, _wstUSRRate: string) => {
|
|
1817
|
+
wstUSRRate: Dec;
|
|
1818
|
+
USRRate: Dec;
|
|
1819
|
+
};
|
|
1331
1820
|
export declare const parseWeETHPriceCalls: (_ethPrice: string, weETHrateAnswer: string, decimals: string) => {
|
|
1332
1821
|
ethPrice: Dec;
|
|
1333
1822
|
weETHRate: string;
|
|
@@ -12,12 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getChainlinkAssetAddress = exports.getEthPriceForFluid = exports.getBTCPriceForFluid = exports.getWstETHPriceFluid = exports.parseWeETHPriceCalls = exports.parseWstETHPriceCalls = exports.getWeETHChainLinkPriceCalls = exports.getWstETHChainLinkPriceCalls = exports.getWeETHPrice = exports.getWstETHPrice = exports.getCompPrice = exports.getUSDCPrice = exports.getEthPrice = void 0;
|
|
15
|
+
exports.getChainlinkAssetAddress = exports.getEthPriceForFluid = exports.getBTCPriceForFluid = exports.getWstETHPriceFluid = exports.parseWeETHPriceCalls = exports.parseWstUSRPriceCalls = exports.parseSyrupUSDTPriceCalls = exports.parseWrsETHPriceCalls = exports.parseWstETHPriceCalls = exports.getWstUSRChainLinkPriceCalls = exports.getSyrupUSDTChainLinkPriceCalls = exports.getWsrETHChainLinkPriceCalls = exports.getWeETHChainLinkPriceCalls = exports.getWstETHChainLinkPriceCalls = exports.getWstUSRPrice = exports.getSyrupUSDTPrice = exports.getWsrETHPrice = exports.getWeETHPrice = exports.getWstETHPrice = exports.getCompPrice = exports.getUSDCPrice = exports.getEthPrice = void 0;
|
|
16
16
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
17
|
const tokens_1 = require("@defisaver/tokens");
|
|
18
18
|
const contracts_1 = require("../contracts");
|
|
19
19
|
const common_1 = require("../types/common");
|
|
20
20
|
const utils_1 = require("./utils");
|
|
21
|
+
const constants_1 = require("../constants");
|
|
21
22
|
const getEthPrice = (client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
const contract = (0, contracts_1.ETHPriceFeedContractViem)(client, common_1.NetworkNumber.Eth);
|
|
23
24
|
const price = yield contract.read.latestAnswer();
|
|
@@ -62,6 +63,39 @@ const getWeETHPrice = (client_1, ...args_1) => __awaiter(void 0, [client_1, ...a
|
|
|
62
63
|
return new decimal_js_1.default(ethPrice).mul(weETHRate).toString();
|
|
63
64
|
});
|
|
64
65
|
exports.getWeETHPrice = getWeETHPrice;
|
|
66
|
+
const getWsrETHPrice = (client_1, ...args_1) => __awaiter(void 0, [client_1, ...args_1], void 0, function* (client, network = common_1.NetworkNumber.Eth) {
|
|
67
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(client, network);
|
|
68
|
+
const [ethPriceWei, wrsETHRateWei] = yield Promise.all([
|
|
69
|
+
feedRegistryContract.read.latestRoundData([(0, tokens_1.getAssetInfo)('WETH', network).address, constants_1.USD_QUOTE]),
|
|
70
|
+
feedRegistryContract.read.latestRoundData([(0, tokens_1.getAssetInfo)('wrsETH', network).address, (0, tokens_1.getAssetInfo)('WETH', network).address]),
|
|
71
|
+
]);
|
|
72
|
+
const ethPrice = new decimal_js_1.default(ethPriceWei[1].toString()).div(1e8);
|
|
73
|
+
const wrsETHRate = (0, utils_1.getEthAmountForDecimals)(wrsETHRateWei[1].toString(), 18);
|
|
74
|
+
return new decimal_js_1.default(ethPrice).mul(wrsETHRate).toString();
|
|
75
|
+
});
|
|
76
|
+
exports.getWsrETHPrice = getWsrETHPrice;
|
|
77
|
+
const getSyrupUSDTPrice = (client_1, ...args_1) => __awaiter(void 0, [client_1, ...args_1], void 0, function* (client, network = common_1.NetworkNumber.Eth) {
|
|
78
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(client, network);
|
|
79
|
+
const [usdtPriceWei, syrupUSDTRateWei] = yield Promise.all([
|
|
80
|
+
feedRegistryContract.read.latestRoundData([(0, tokens_1.getAssetInfo)('USDT', network).address, constants_1.USD_QUOTE]),
|
|
81
|
+
feedRegistryContract.read.latestRoundData([(0, tokens_1.getAssetInfo)('syrupUSDT', network).address, (0, tokens_1.getAssetInfo)('USDT', network).address]),
|
|
82
|
+
]);
|
|
83
|
+
const usdtPrice = new decimal_js_1.default(usdtPriceWei[1].toString()).div(1e8);
|
|
84
|
+
const syrupUSDTPrice = (0, utils_1.getEthAmountForDecimals)(syrupUSDTRateWei[1].toString(), 18);
|
|
85
|
+
return new decimal_js_1.default(usdtPrice).mul(syrupUSDTPrice).toString();
|
|
86
|
+
});
|
|
87
|
+
exports.getSyrupUSDTPrice = getSyrupUSDTPrice;
|
|
88
|
+
const getWstUSRPrice = (client_1, ...args_1) => __awaiter(void 0, [client_1, ...args_1], void 0, function* (client, network = common_1.NetworkNumber.Eth) {
|
|
89
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(client, network);
|
|
90
|
+
const [usrPriceWei, wstUSRRateWei] = yield Promise.all([
|
|
91
|
+
feedRegistryContract.read.latestRoundData([(0, tokens_1.getAssetInfo)('USR', network).address, constants_1.USD_QUOTE]),
|
|
92
|
+
feedRegistryContract.read.latestRoundData([(0, tokens_1.getAssetInfo)('wstUSR', network).address, (0, tokens_1.getAssetInfo)('USR', network).address]),
|
|
93
|
+
]);
|
|
94
|
+
const usrPrice = new decimal_js_1.default(usrPriceWei[1].toString()).div(1e8);
|
|
95
|
+
const wstUSRPrice = (0, utils_1.getEthAmountForDecimals)(wstUSRRateWei[1].toString(), 18);
|
|
96
|
+
return new decimal_js_1.default(usrPrice).mul(wstUSRPrice).toString();
|
|
97
|
+
});
|
|
98
|
+
exports.getWstUSRPrice = getWstUSRPrice;
|
|
65
99
|
const getWstETHChainLinkPriceCalls = (client, network) => {
|
|
66
100
|
const wstETHFeedContract = (0, contracts_1.WstETHPriceFeedContractViem)(client, network);
|
|
67
101
|
const ethFeedContract = (0, contracts_1.ETHPriceFeedContractViem)(client, network);
|
|
@@ -114,12 +148,87 @@ const getWeETHChainLinkPriceCalls = (client, network) => {
|
|
|
114
148
|
return calls;
|
|
115
149
|
};
|
|
116
150
|
exports.getWeETHChainLinkPriceCalls = getWeETHChainLinkPriceCalls;
|
|
151
|
+
const getWsrETHChainLinkPriceCalls = (client, network) => {
|
|
152
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(client, network);
|
|
153
|
+
const calls = [
|
|
154
|
+
{
|
|
155
|
+
address: feedRegistryContract.address,
|
|
156
|
+
abi: feedRegistryContract.abi,
|
|
157
|
+
functionName: 'latestRoundData',
|
|
158
|
+
args: [(0, tokens_1.getAssetInfo)('WETH', network).address, constants_1.USD_QUOTE],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
address: feedRegistryContract.address,
|
|
162
|
+
abi: feedRegistryContract.abi,
|
|
163
|
+
functionName: 'latestRoundData',
|
|
164
|
+
args: [(0, tokens_1.getAssetInfo)('wrsETH', network).address, (0, tokens_1.getAssetInfo)('WETH', network).address],
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
return calls;
|
|
168
|
+
};
|
|
169
|
+
exports.getWsrETHChainLinkPriceCalls = getWsrETHChainLinkPriceCalls;
|
|
170
|
+
const getSyrupUSDTChainLinkPriceCalls = (client, network) => {
|
|
171
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(client, network);
|
|
172
|
+
const calls = [
|
|
173
|
+
{
|
|
174
|
+
address: feedRegistryContract.address,
|
|
175
|
+
abi: feedRegistryContract.abi,
|
|
176
|
+
functionName: 'latestRoundData',
|
|
177
|
+
args: [(0, tokens_1.getAssetInfo)('USDT', network).address, constants_1.USD_QUOTE],
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
address: feedRegistryContract.address,
|
|
181
|
+
abi: feedRegistryContract.abi,
|
|
182
|
+
functionName: 'latestRoundData',
|
|
183
|
+
args: [(0, tokens_1.getAssetInfo)('syrupUSDT', network).address, (0, tokens_1.getAssetInfo)('USDT', network).address],
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
return calls;
|
|
187
|
+
};
|
|
188
|
+
exports.getSyrupUSDTChainLinkPriceCalls = getSyrupUSDTChainLinkPriceCalls;
|
|
189
|
+
const getWstUSRChainLinkPriceCalls = (client, network) => {
|
|
190
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(client, network);
|
|
191
|
+
const calls = [
|
|
192
|
+
{
|
|
193
|
+
address: feedRegistryContract.address,
|
|
194
|
+
abi: feedRegistryContract.abi,
|
|
195
|
+
functionName: 'latestRoundData',
|
|
196
|
+
args: [(0, tokens_1.getAssetInfo)('USR', network).address, constants_1.USD_QUOTE],
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
address: feedRegistryContract.address,
|
|
200
|
+
abi: feedRegistryContract.abi,
|
|
201
|
+
functionName: 'latestRoundData',
|
|
202
|
+
args: [(0, tokens_1.getAssetInfo)('wstUSR', network).address, (0, tokens_1.getAssetInfo)('USR', network).address],
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
return calls;
|
|
206
|
+
};
|
|
207
|
+
exports.getWstUSRChainLinkPriceCalls = getWstUSRChainLinkPriceCalls;
|
|
117
208
|
const parseWstETHPriceCalls = (_ethPrice, wstETHrateAnswer, decimals) => {
|
|
118
209
|
const ethPrice = new decimal_js_1.default(_ethPrice).div(1e8);
|
|
119
210
|
const wstETHRate = (0, utils_1.getEthAmountForDecimals)(wstETHrateAnswer, decimals);
|
|
120
211
|
return { ethPrice, wstETHRate };
|
|
121
212
|
};
|
|
122
213
|
exports.parseWstETHPriceCalls = parseWstETHPriceCalls;
|
|
214
|
+
const parseWrsETHPriceCalls = (ethPriceAnswer, wrsETHrateAnswer) => {
|
|
215
|
+
const ethPrice = new decimal_js_1.default(ethPriceAnswer).div(1e8);
|
|
216
|
+
const wrsETHRate = new decimal_js_1.default(wrsETHrateAnswer).div(1e18);
|
|
217
|
+
return { ethPrice, wrsETHRate };
|
|
218
|
+
};
|
|
219
|
+
exports.parseWrsETHPriceCalls = parseWrsETHPriceCalls;
|
|
220
|
+
const parseSyrupUSDTPriceCalls = (usdtPriceAnswer, syrupUSDTRateAnswer) => {
|
|
221
|
+
const syrupUSDTRate = new decimal_js_1.default(syrupUSDTRateAnswer).div(1e8);
|
|
222
|
+
const USDTRate = new decimal_js_1.default(usdtPriceAnswer).div(1e18);
|
|
223
|
+
return { syrupUSDTRate, USDTRate };
|
|
224
|
+
};
|
|
225
|
+
exports.parseSyrupUSDTPriceCalls = parseSyrupUSDTPriceCalls;
|
|
226
|
+
const parseWstUSRPriceCalls = (usrPrice, _wstUSRRate) => {
|
|
227
|
+
const wstUSRRate = new decimal_js_1.default(_wstUSRRate).div(1e8);
|
|
228
|
+
const USRRate = new decimal_js_1.default(usrPrice).div(1e18);
|
|
229
|
+
return { wstUSRRate, USRRate };
|
|
230
|
+
};
|
|
231
|
+
exports.parseWstUSRPriceCalls = parseWstUSRPriceCalls;
|
|
123
232
|
const parseWeETHPriceCalls = (_ethPrice, weETHrateAnswer, decimals) => {
|
|
124
233
|
const ethPrice = new decimal_js_1.default(_ethPrice).div(1e8);
|
|
125
234
|
const weETHRate = (0, utils_1.getEthAmountForDecimals)(weETHrateAnswer, decimals);
|
|
@@ -152,7 +261,7 @@ const getChainlinkAssetAddress = (symbol, network) => {
|
|
|
152
261
|
// Chainlink only has BTC/USD feed so we use that for BTC derivatives
|
|
153
262
|
if (['WBTC', 'RENBTC'].includes(symbol === null || symbol === void 0 ? void 0 : symbol.toUpperCase()))
|
|
154
263
|
return '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB';
|
|
155
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.toUpperCase()) === 'WETH')
|
|
264
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.toUpperCase()) === 'WETH' && network !== common_1.NetworkNumber.Plasma)
|
|
156
265
|
return (0, tokens_1.getAssetInfo)('ETH').addresses[network];
|
|
157
266
|
return (0, tokens_1.getAssetInfo)(symbol).addresses[network];
|
|
158
267
|
};
|