@defisaver/positions-sdk 2.1.13-dev-plasma-fluid5 → 2.1.13-dev-plasma-fluid7

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.
@@ -74,6 +74,12 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
74
74
  return (0, priceService_1.getWstETHChainLinkPriceCalls)(client, network);
75
75
  if (assetInfo.symbol === 'weETH' && network !== common_1.NetworkNumber.Plasma)
76
76
  return (0, priceService_1.getWeETHChainLinkPriceCalls)(client, network);
77
+ if (assetInfo.symbol === 'wrsETH' && network === common_1.NetworkNumber.Plasma)
78
+ return (0, priceService_1.getWsrETHChainLinkPriceCalls)(client, network);
79
+ if (assetInfo.symbol === 'syrupUSDT')
80
+ return (0, priceService_1.getSyrupUSDTChainLinkPriceCalls)(client, network);
81
+ if (assetInfo.symbol === 'wstUSR')
82
+ return (0, priceService_1.getWstUSRChainLinkPriceCalls)(client, network);
77
83
  if (isMainnet) {
78
84
  const feedRegistryContract = (0, contracts_1.FeedRegistryContractViem)(client, common_1.NetworkNumber.Eth);
79
85
  return ({
@@ -112,6 +118,36 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
112
118
  acc[token] = new decimal_js_1.default(ethPrice).mul(wstETHRate).toString();
113
119
  break;
114
120
  }
121
+ case 'wrsETH': {
122
+ const { ethPrice, wrsETHRate, } = (0, priceService_1.parseWrsETHPriceCalls)(
123
+ // @ts-ignore
124
+ results[i + offset].result[1].toString(),
125
+ // @ts-ignore
126
+ results[i + offset + 1].result[1].toString());
127
+ offset += 1;
128
+ acc[token] = new decimal_js_1.default(ethPrice).mul(wrsETHRate).toString();
129
+ break;
130
+ }
131
+ case 'syrupUSDT': {
132
+ const { syrupUSDTRate, USDTRate, } = (0, priceService_1.parseSyrupUSDTPriceCalls)(
133
+ // @ts-ignore
134
+ results[i + offset].result[1].toString(),
135
+ // @ts-ignore
136
+ results[i + offset + 1].result[1].toString());
137
+ offset += 1;
138
+ acc[token] = new decimal_js_1.default(syrupUSDTRate).mul(USDTRate).toString();
139
+ break;
140
+ }
141
+ case 'wstUSR': {
142
+ const { wstUSRRate, USRRate, } = (0, priceService_1.parseWstUSRPriceCalls)(
143
+ // @ts-ignore
144
+ results[i + offset].result[1].toString(),
145
+ // @ts-ignore
146
+ results[i + offset + 1].result[1].toString());
147
+ offset += 1;
148
+ acc[token] = new decimal_js_1.default(wstUSRRate).mul(USRRate).toString();
149
+ break;
150
+ }
115
151
  // TODO: These addresses do not have chainlink feeds, so we need to handle them separately, this is hotfix
116
152
  case 'ezETH': {
117
153
  acc[token] = new decimal_js_1.default(ethPriceChainlink).mul(1.049).toString();
@@ -1230,6 +1266,15 @@ const getTokenPricePortfolio = (token, provider, network) => __awaiter(void 0, v
1230
1266
  if (token === 'weETH' && network !== common_1.NetworkNumber.Plasma) {
1231
1267
  return (0, priceService_1.getWeETHPrice)(provider, network);
1232
1268
  }
1269
+ if (token === 'wrsETH') {
1270
+ return (0, priceService_1.getWsrETHPrice)(provider, network);
1271
+ }
1272
+ if (token === 'syrupUSDT') {
1273
+ return (0, priceService_1.getSyrupUSDTPrice)(provider, network);
1274
+ }
1275
+ if (token === 'wstUSR') {
1276
+ return (0, priceService_1.getWstUSRPrice)(provider, network);
1277
+ }
1233
1278
  const isMainnet = (0, utils_1.isMainnetNetwork)(network);
1234
1279
  const chainLinkFeedAddress = (0, priceService_1.getChainlinkAssetAddress)(token, network);
1235
1280
  if (isMainnet) {
@@ -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;