@aspan/sdk 0.4.0 → 0.4.1
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/README.md +44 -4
- package/dist/index.d.mts +165 -5
- package/dist/index.d.ts +165 -5
- package/dist/index.js +170 -5
- package/dist/index.mjs +170 -5
- package/package.json +1 -1
- package/src/__tests__/fork.test.ts +2 -2
- package/src/abi/diamond.ts +74 -0
- package/src/abi/sApUSD.ts +100 -0
- package/src/bot/config.ts +51 -1
- package/src/bot/index.ts +69 -1
- package/src/bot/services/fee-manager.ts +303 -0
- package/src/bot/services/risk-keeper.ts +519 -0
- package/src/client.ts +109 -0
- package/src/index.ts +5 -5
package/dist/index.js
CHANGED
|
@@ -522,6 +522,30 @@ var DiamondABI = [
|
|
|
522
522
|
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
523
523
|
stateMutability: "view"
|
|
524
524
|
},
|
|
525
|
+
{
|
|
526
|
+
type: "function",
|
|
527
|
+
name: "bootstrap",
|
|
528
|
+
inputs: [
|
|
529
|
+
{ name: "_lstToken", type: "address", internalType: "address" },
|
|
530
|
+
{ name: "_lstAmount", type: "uint256", internalType: "uint256" }
|
|
531
|
+
],
|
|
532
|
+
outputs: [{ name: "xBNBAmount", type: "uint256", internalType: "uint256" }],
|
|
533
|
+
stateMutability: "nonpayable"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: "function",
|
|
537
|
+
name: "isBootstrapped",
|
|
538
|
+
inputs: [],
|
|
539
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
540
|
+
stateMutability: "view"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
type: "function",
|
|
544
|
+
name: "getBootstrapXBNBAmount",
|
|
545
|
+
inputs: [],
|
|
546
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
547
|
+
stateMutability: "view"
|
|
548
|
+
},
|
|
525
549
|
// ============ StabilityModeFacet ============
|
|
526
550
|
{
|
|
527
551
|
type: "function",
|
|
@@ -554,6 +578,13 @@ var DiamondABI = [
|
|
|
554
578
|
],
|
|
555
579
|
stateMutability: "nonpayable"
|
|
556
580
|
},
|
|
581
|
+
{
|
|
582
|
+
type: "function",
|
|
583
|
+
name: "cleanXbnb",
|
|
584
|
+
inputs: [{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" }],
|
|
585
|
+
outputs: [],
|
|
586
|
+
stateMutability: "nonpayable"
|
|
587
|
+
},
|
|
557
588
|
// ============ StabilityModeFacet Events ============
|
|
558
589
|
{
|
|
559
590
|
type: "event",
|
|
@@ -573,6 +604,48 @@ var DiamondABI = [
|
|
|
573
604
|
inputs: [],
|
|
574
605
|
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
575
606
|
stateMutability: "view"
|
|
607
|
+
},
|
|
608
|
+
// ============ Fee Manager ============
|
|
609
|
+
{
|
|
610
|
+
type: "function",
|
|
611
|
+
name: "setFeeManager",
|
|
612
|
+
inputs: [{ name: "_feeManager", type: "address", internalType: "address" }],
|
|
613
|
+
outputs: [],
|
|
614
|
+
stateMutability: "nonpayable"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
type: "function",
|
|
618
|
+
name: "getFeeManager",
|
|
619
|
+
inputs: [],
|
|
620
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
621
|
+
stateMutability: "view"
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
type: "function",
|
|
625
|
+
name: "setFeeTiers",
|
|
626
|
+
inputs: [{
|
|
627
|
+
name: "_tiers",
|
|
628
|
+
type: "tuple[]",
|
|
629
|
+
internalType: "struct LibAppStorage.FeeTier[]",
|
|
630
|
+
components: [
|
|
631
|
+
{ name: "minCR", type: "uint256", internalType: "uint256" },
|
|
632
|
+
{ name: "apUSDMintFee", type: "uint16", internalType: "uint16" },
|
|
633
|
+
{ name: "apUSDRedeemFee", type: "uint16", internalType: "uint16" },
|
|
634
|
+
{ name: "xBNBMintFee", type: "uint16", internalType: "uint16" },
|
|
635
|
+
{ name: "xBNBRedeemFee", type: "uint16", internalType: "uint16" },
|
|
636
|
+
{ name: "apUSDMintDisabled", type: "bool", internalType: "bool" }
|
|
637
|
+
]
|
|
638
|
+
}],
|
|
639
|
+
outputs: [],
|
|
640
|
+
stateMutability: "nonpayable"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
type: "event",
|
|
644
|
+
name: "FeeManagerSet",
|
|
645
|
+
inputs: [
|
|
646
|
+
{ name: "feeManager", type: "address", indexed: true, internalType: "address" }
|
|
647
|
+
],
|
|
648
|
+
anonymous: false
|
|
576
649
|
}
|
|
577
650
|
];
|
|
578
651
|
|
|
@@ -1217,6 +1290,29 @@ var AspanReadClient = class _AspanReadClient {
|
|
|
1217
1290
|
functionName: "isPaused"
|
|
1218
1291
|
});
|
|
1219
1292
|
}
|
|
1293
|
+
// ============ Bootstrap View Functions ============
|
|
1294
|
+
/**
|
|
1295
|
+
* Check if xBNB liquidity has been bootstrapped
|
|
1296
|
+
* @returns true if bootstrap has been called
|
|
1297
|
+
*/
|
|
1298
|
+
async isBootstrapped() {
|
|
1299
|
+
return this.publicClient.readContract({
|
|
1300
|
+
address: this.diamondAddress,
|
|
1301
|
+
abi: DiamondABI,
|
|
1302
|
+
functionName: "isBootstrapped"
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Get the amount of xBNB locked in bootstrap (burned to dead address)
|
|
1307
|
+
* @returns xBNB amount in wei
|
|
1308
|
+
*/
|
|
1309
|
+
async getBootstrapXBNBAmount() {
|
|
1310
|
+
return this.publicClient.readContract({
|
|
1311
|
+
address: this.diamondAddress,
|
|
1312
|
+
abi: DiamondABI,
|
|
1313
|
+
functionName: "getBootstrapXBNBAmount"
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1220
1316
|
// ============ Stability Mode View Functions ============
|
|
1221
1317
|
async getStabilityMode() {
|
|
1222
1318
|
try {
|
|
@@ -1416,6 +1512,75 @@ var AspanClient = class extends AspanReadClient {
|
|
|
1416
1512
|
functionName: "harvestYield"
|
|
1417
1513
|
});
|
|
1418
1514
|
}
|
|
1515
|
+
// ============ Risk Management Functions ============
|
|
1516
|
+
/**
|
|
1517
|
+
* Trigger Stability Mode 2 forced conversion
|
|
1518
|
+
* @description Anyone can call when CR < 130%. Burns apUSD from stability pool
|
|
1519
|
+
* and mints xBNB to compensate stakers.
|
|
1520
|
+
* @param targetCR Target CR to restore to (in BPS, e.g., 14000 = 140%)
|
|
1521
|
+
* @returns Transaction hash
|
|
1522
|
+
*/
|
|
1523
|
+
async triggerStabilityMode2(targetCR = 14000n) {
|
|
1524
|
+
return this.walletClient.writeContract({
|
|
1525
|
+
chain: this.chain,
|
|
1526
|
+
account: this.walletClient.account,
|
|
1527
|
+
address: this.diamondAddress,
|
|
1528
|
+
abi: DiamondABI,
|
|
1529
|
+
functionName: "triggerStabilityMode2",
|
|
1530
|
+
args: [targetCR]
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Clean underwater xBNB (burn without getting LST back)
|
|
1535
|
+
* @description Only works when xBNB is underwater (price = 0)
|
|
1536
|
+
* @param xBNBAmount Amount of xBNB to clean (burn)
|
|
1537
|
+
* @returns Transaction hash
|
|
1538
|
+
*/
|
|
1539
|
+
async cleanXbnb(xBNBAmount) {
|
|
1540
|
+
return this.walletClient.writeContract({
|
|
1541
|
+
chain: this.chain,
|
|
1542
|
+
account: this.walletClient.account,
|
|
1543
|
+
address: this.diamondAddress,
|
|
1544
|
+
abi: DiamondABI,
|
|
1545
|
+
functionName: "cleanXbnb",
|
|
1546
|
+
args: [xBNBAmount]
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
// ============ Fee Management Functions ============
|
|
1550
|
+
/**
|
|
1551
|
+
* Set fee tiers (requires feeManager or owner role)
|
|
1552
|
+
* @param tiers Array of fee tier configurations
|
|
1553
|
+
* @returns Transaction hash
|
|
1554
|
+
*/
|
|
1555
|
+
async setFeeTiers(tiers) {
|
|
1556
|
+
return this.walletClient.writeContract({
|
|
1557
|
+
chain: this.chain,
|
|
1558
|
+
account: this.walletClient.account,
|
|
1559
|
+
address: this.diamondAddress,
|
|
1560
|
+
abi: DiamondABI,
|
|
1561
|
+
functionName: "setFeeTiers",
|
|
1562
|
+
args: [tiers]
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
// ============ Admin Functions ============
|
|
1566
|
+
/**
|
|
1567
|
+
* Bootstrap xBNB liquidity (owner only)
|
|
1568
|
+
* @description Initializes xBNB supply by minting to dead address, preventing extreme initial prices.
|
|
1569
|
+
* Similar to Uniswap V2's MINIMUM_LIQUIDITY. Can only be called once.
|
|
1570
|
+
* @param lstToken LST token address to deposit
|
|
1571
|
+
* @param lstAmount Amount of LST to deposit for bootstrap
|
|
1572
|
+
* @returns Transaction hash
|
|
1573
|
+
*/
|
|
1574
|
+
async bootstrap(lstToken, lstAmount) {
|
|
1575
|
+
return this.walletClient.writeContract({
|
|
1576
|
+
chain: this.chain,
|
|
1577
|
+
account: this.walletClient.account,
|
|
1578
|
+
address: this.diamondAddress,
|
|
1579
|
+
abi: DiamondABI,
|
|
1580
|
+
functionName: "bootstrap",
|
|
1581
|
+
args: [lstToken, lstAmount]
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1419
1584
|
// ============ Transaction Helpers ============
|
|
1420
1585
|
/**
|
|
1421
1586
|
* Wait for transaction confirmation
|
|
@@ -2241,15 +2406,15 @@ var PRECISION = 10n ** 18n;
|
|
|
2241
2406
|
var BPS_PRECISION = 10000n;
|
|
2242
2407
|
var PRICE_PRECISION = 10n ** 8n;
|
|
2243
2408
|
var BSC_ADDRESSES = {
|
|
2244
|
-
diamond: "
|
|
2409
|
+
diamond: "0x6a11B30d3a70727d5477D6d8090e144443fA1c78",
|
|
2245
2410
|
router: "0x813d3D1A3154950E2f1d8718305426a335A974A9",
|
|
2246
|
-
apUSD: "
|
|
2247
|
-
xBNB: "
|
|
2248
|
-
sApUSD: "
|
|
2411
|
+
apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287",
|
|
2412
|
+
xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43",
|
|
2413
|
+
sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF",
|
|
2249
2414
|
// LSTs
|
|
2250
2415
|
slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
|
|
2251
2416
|
asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6",
|
|
2252
|
-
wclisBNB: "
|
|
2417
|
+
wclisBNB: "0x448f7c2fa4e5135a4a5B50879602cf3CD428e108",
|
|
2253
2418
|
// Stablecoins
|
|
2254
2419
|
USDT: "0x55d398326f99059fF775485246999027B3197955",
|
|
2255
2420
|
USDC: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
package/dist/index.mjs
CHANGED
|
@@ -476,6 +476,30 @@ var DiamondABI = [
|
|
|
476
476
|
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
477
477
|
stateMutability: "view"
|
|
478
478
|
},
|
|
479
|
+
{
|
|
480
|
+
type: "function",
|
|
481
|
+
name: "bootstrap",
|
|
482
|
+
inputs: [
|
|
483
|
+
{ name: "_lstToken", type: "address", internalType: "address" },
|
|
484
|
+
{ name: "_lstAmount", type: "uint256", internalType: "uint256" }
|
|
485
|
+
],
|
|
486
|
+
outputs: [{ name: "xBNBAmount", type: "uint256", internalType: "uint256" }],
|
|
487
|
+
stateMutability: "nonpayable"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
type: "function",
|
|
491
|
+
name: "isBootstrapped",
|
|
492
|
+
inputs: [],
|
|
493
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
494
|
+
stateMutability: "view"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
type: "function",
|
|
498
|
+
name: "getBootstrapXBNBAmount",
|
|
499
|
+
inputs: [],
|
|
500
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
501
|
+
stateMutability: "view"
|
|
502
|
+
},
|
|
479
503
|
// ============ StabilityModeFacet ============
|
|
480
504
|
{
|
|
481
505
|
type: "function",
|
|
@@ -508,6 +532,13 @@ var DiamondABI = [
|
|
|
508
532
|
],
|
|
509
533
|
stateMutability: "nonpayable"
|
|
510
534
|
},
|
|
535
|
+
{
|
|
536
|
+
type: "function",
|
|
537
|
+
name: "cleanXbnb",
|
|
538
|
+
inputs: [{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" }],
|
|
539
|
+
outputs: [],
|
|
540
|
+
stateMutability: "nonpayable"
|
|
541
|
+
},
|
|
511
542
|
// ============ StabilityModeFacet Events ============
|
|
512
543
|
{
|
|
513
544
|
type: "event",
|
|
@@ -527,6 +558,48 @@ var DiamondABI = [
|
|
|
527
558
|
inputs: [],
|
|
528
559
|
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
529
560
|
stateMutability: "view"
|
|
561
|
+
},
|
|
562
|
+
// ============ Fee Manager ============
|
|
563
|
+
{
|
|
564
|
+
type: "function",
|
|
565
|
+
name: "setFeeManager",
|
|
566
|
+
inputs: [{ name: "_feeManager", type: "address", internalType: "address" }],
|
|
567
|
+
outputs: [],
|
|
568
|
+
stateMutability: "nonpayable"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
type: "function",
|
|
572
|
+
name: "getFeeManager",
|
|
573
|
+
inputs: [],
|
|
574
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
575
|
+
stateMutability: "view"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
type: "function",
|
|
579
|
+
name: "setFeeTiers",
|
|
580
|
+
inputs: [{
|
|
581
|
+
name: "_tiers",
|
|
582
|
+
type: "tuple[]",
|
|
583
|
+
internalType: "struct LibAppStorage.FeeTier[]",
|
|
584
|
+
components: [
|
|
585
|
+
{ name: "minCR", type: "uint256", internalType: "uint256" },
|
|
586
|
+
{ name: "apUSDMintFee", type: "uint16", internalType: "uint16" },
|
|
587
|
+
{ name: "apUSDRedeemFee", type: "uint16", internalType: "uint16" },
|
|
588
|
+
{ name: "xBNBMintFee", type: "uint16", internalType: "uint16" },
|
|
589
|
+
{ name: "xBNBRedeemFee", type: "uint16", internalType: "uint16" },
|
|
590
|
+
{ name: "apUSDMintDisabled", type: "bool", internalType: "bool" }
|
|
591
|
+
]
|
|
592
|
+
}],
|
|
593
|
+
outputs: [],
|
|
594
|
+
stateMutability: "nonpayable"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
type: "event",
|
|
598
|
+
name: "FeeManagerSet",
|
|
599
|
+
inputs: [
|
|
600
|
+
{ name: "feeManager", type: "address", indexed: true, internalType: "address" }
|
|
601
|
+
],
|
|
602
|
+
anonymous: false
|
|
530
603
|
}
|
|
531
604
|
];
|
|
532
605
|
|
|
@@ -1171,6 +1244,29 @@ var AspanReadClient = class _AspanReadClient {
|
|
|
1171
1244
|
functionName: "isPaused"
|
|
1172
1245
|
});
|
|
1173
1246
|
}
|
|
1247
|
+
// ============ Bootstrap View Functions ============
|
|
1248
|
+
/**
|
|
1249
|
+
* Check if xBNB liquidity has been bootstrapped
|
|
1250
|
+
* @returns true if bootstrap has been called
|
|
1251
|
+
*/
|
|
1252
|
+
async isBootstrapped() {
|
|
1253
|
+
return this.publicClient.readContract({
|
|
1254
|
+
address: this.diamondAddress,
|
|
1255
|
+
abi: DiamondABI,
|
|
1256
|
+
functionName: "isBootstrapped"
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Get the amount of xBNB locked in bootstrap (burned to dead address)
|
|
1261
|
+
* @returns xBNB amount in wei
|
|
1262
|
+
*/
|
|
1263
|
+
async getBootstrapXBNBAmount() {
|
|
1264
|
+
return this.publicClient.readContract({
|
|
1265
|
+
address: this.diamondAddress,
|
|
1266
|
+
abi: DiamondABI,
|
|
1267
|
+
functionName: "getBootstrapXBNBAmount"
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1174
1270
|
// ============ Stability Mode View Functions ============
|
|
1175
1271
|
async getStabilityMode() {
|
|
1176
1272
|
try {
|
|
@@ -1370,6 +1466,75 @@ var AspanClient = class extends AspanReadClient {
|
|
|
1370
1466
|
functionName: "harvestYield"
|
|
1371
1467
|
});
|
|
1372
1468
|
}
|
|
1469
|
+
// ============ Risk Management Functions ============
|
|
1470
|
+
/**
|
|
1471
|
+
* Trigger Stability Mode 2 forced conversion
|
|
1472
|
+
* @description Anyone can call when CR < 130%. Burns apUSD from stability pool
|
|
1473
|
+
* and mints xBNB to compensate stakers.
|
|
1474
|
+
* @param targetCR Target CR to restore to (in BPS, e.g., 14000 = 140%)
|
|
1475
|
+
* @returns Transaction hash
|
|
1476
|
+
*/
|
|
1477
|
+
async triggerStabilityMode2(targetCR = 14000n) {
|
|
1478
|
+
return this.walletClient.writeContract({
|
|
1479
|
+
chain: this.chain,
|
|
1480
|
+
account: this.walletClient.account,
|
|
1481
|
+
address: this.diamondAddress,
|
|
1482
|
+
abi: DiamondABI,
|
|
1483
|
+
functionName: "triggerStabilityMode2",
|
|
1484
|
+
args: [targetCR]
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Clean underwater xBNB (burn without getting LST back)
|
|
1489
|
+
* @description Only works when xBNB is underwater (price = 0)
|
|
1490
|
+
* @param xBNBAmount Amount of xBNB to clean (burn)
|
|
1491
|
+
* @returns Transaction hash
|
|
1492
|
+
*/
|
|
1493
|
+
async cleanXbnb(xBNBAmount) {
|
|
1494
|
+
return this.walletClient.writeContract({
|
|
1495
|
+
chain: this.chain,
|
|
1496
|
+
account: this.walletClient.account,
|
|
1497
|
+
address: this.diamondAddress,
|
|
1498
|
+
abi: DiamondABI,
|
|
1499
|
+
functionName: "cleanXbnb",
|
|
1500
|
+
args: [xBNBAmount]
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
// ============ Fee Management Functions ============
|
|
1504
|
+
/**
|
|
1505
|
+
* Set fee tiers (requires feeManager or owner role)
|
|
1506
|
+
* @param tiers Array of fee tier configurations
|
|
1507
|
+
* @returns Transaction hash
|
|
1508
|
+
*/
|
|
1509
|
+
async setFeeTiers(tiers) {
|
|
1510
|
+
return this.walletClient.writeContract({
|
|
1511
|
+
chain: this.chain,
|
|
1512
|
+
account: this.walletClient.account,
|
|
1513
|
+
address: this.diamondAddress,
|
|
1514
|
+
abi: DiamondABI,
|
|
1515
|
+
functionName: "setFeeTiers",
|
|
1516
|
+
args: [tiers]
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
// ============ Admin Functions ============
|
|
1520
|
+
/**
|
|
1521
|
+
* Bootstrap xBNB liquidity (owner only)
|
|
1522
|
+
* @description Initializes xBNB supply by minting to dead address, preventing extreme initial prices.
|
|
1523
|
+
* Similar to Uniswap V2's MINIMUM_LIQUIDITY. Can only be called once.
|
|
1524
|
+
* @param lstToken LST token address to deposit
|
|
1525
|
+
* @param lstAmount Amount of LST to deposit for bootstrap
|
|
1526
|
+
* @returns Transaction hash
|
|
1527
|
+
*/
|
|
1528
|
+
async bootstrap(lstToken, lstAmount) {
|
|
1529
|
+
return this.walletClient.writeContract({
|
|
1530
|
+
chain: this.chain,
|
|
1531
|
+
account: this.walletClient.account,
|
|
1532
|
+
address: this.diamondAddress,
|
|
1533
|
+
abi: DiamondABI,
|
|
1534
|
+
functionName: "bootstrap",
|
|
1535
|
+
args: [lstToken, lstAmount]
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1373
1538
|
// ============ Transaction Helpers ============
|
|
1374
1539
|
/**
|
|
1375
1540
|
* Wait for transaction confirmation
|
|
@@ -2200,15 +2365,15 @@ var PRECISION = 10n ** 18n;
|
|
|
2200
2365
|
var BPS_PRECISION = 10000n;
|
|
2201
2366
|
var PRICE_PRECISION = 10n ** 8n;
|
|
2202
2367
|
var BSC_ADDRESSES = {
|
|
2203
|
-
diamond: "
|
|
2368
|
+
diamond: "0x6a11B30d3a70727d5477D6d8090e144443fA1c78",
|
|
2204
2369
|
router: "0x813d3D1A3154950E2f1d8718305426a335A974A9",
|
|
2205
|
-
apUSD: "
|
|
2206
|
-
xBNB: "
|
|
2207
|
-
sApUSD: "
|
|
2370
|
+
apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287",
|
|
2371
|
+
xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43",
|
|
2372
|
+
sApUSD: "0x73407A291c007a47CC926EcD5CaC256A1E2d00cF",
|
|
2208
2373
|
// LSTs
|
|
2209
2374
|
slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
|
|
2210
2375
|
asBNB: "0x77734e70b6E88b4d82fE632a168EDf6e700912b6",
|
|
2211
|
-
wclisBNB: "
|
|
2376
|
+
wclisBNB: "0x448f7c2fa4e5135a4a5B50879602cf3CD428e108",
|
|
2212
2377
|
// Stablecoins
|
|
2213
2378
|
USDT: "0x55d398326f99059fF775485246999027B3197955",
|
|
2214
2379
|
USDC: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
package/package.json
CHANGED
|
@@ -27,8 +27,8 @@ const TOKENS = {
|
|
|
27
27
|
WBNB: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" as Address,
|
|
28
28
|
USDT: "0x55d398326f99059fF775485246999027B3197955" as Address,
|
|
29
29
|
slisBNB: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B" as Address,
|
|
30
|
-
apUSD: "
|
|
31
|
-
xBNB: "
|
|
30
|
+
apUSD: "0x4570047eeB5aDb4081c5d470494EB5134e34A287" as Address,
|
|
31
|
+
xBNB: "0x0A0c9CD826e747D99F90D63e780B3727Da4D0d43" as Address,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const ERC20_ABI = [
|
package/src/abi/diamond.ts
CHANGED
|
@@ -477,6 +477,30 @@ export const DiamondABI = [
|
|
|
477
477
|
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
478
478
|
stateMutability: "view"
|
|
479
479
|
},
|
|
480
|
+
{
|
|
481
|
+
type: "function",
|
|
482
|
+
name: "bootstrap",
|
|
483
|
+
inputs: [
|
|
484
|
+
{ name: "_lstToken", type: "address", internalType: "address" },
|
|
485
|
+
{ name: "_lstAmount", type: "uint256", internalType: "uint256" }
|
|
486
|
+
],
|
|
487
|
+
outputs: [{ name: "xBNBAmount", type: "uint256", internalType: "uint256" }],
|
|
488
|
+
stateMutability: "nonpayable"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
type: "function",
|
|
492
|
+
name: "isBootstrapped",
|
|
493
|
+
inputs: [],
|
|
494
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
495
|
+
stateMutability: "view"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
type: "function",
|
|
499
|
+
name: "getBootstrapXBNBAmount",
|
|
500
|
+
inputs: [],
|
|
501
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
502
|
+
stateMutability: "view"
|
|
503
|
+
},
|
|
480
504
|
|
|
481
505
|
// ============ StabilityModeFacet ============
|
|
482
506
|
{
|
|
@@ -510,6 +534,13 @@ export const DiamondABI = [
|
|
|
510
534
|
],
|
|
511
535
|
stateMutability: "nonpayable"
|
|
512
536
|
},
|
|
537
|
+
{
|
|
538
|
+
type: "function",
|
|
539
|
+
name: "cleanXbnb",
|
|
540
|
+
inputs: [{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" }],
|
|
541
|
+
outputs: [],
|
|
542
|
+
stateMutability: "nonpayable"
|
|
543
|
+
},
|
|
513
544
|
|
|
514
545
|
// ============ StabilityModeFacet Events ============
|
|
515
546
|
{
|
|
@@ -531,5 +562,48 @@ export const DiamondABI = [
|
|
|
531
562
|
inputs: [],
|
|
532
563
|
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
533
564
|
stateMutability: "view"
|
|
565
|
+
},
|
|
566
|
+
|
|
567
|
+
// ============ Fee Manager ============
|
|
568
|
+
{
|
|
569
|
+
type: "function",
|
|
570
|
+
name: "setFeeManager",
|
|
571
|
+
inputs: [{ name: "_feeManager", type: "address", internalType: "address" }],
|
|
572
|
+
outputs: [],
|
|
573
|
+
stateMutability: "nonpayable"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
type: "function",
|
|
577
|
+
name: "getFeeManager",
|
|
578
|
+
inputs: [],
|
|
579
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
580
|
+
stateMutability: "view"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
type: "function",
|
|
584
|
+
name: "setFeeTiers",
|
|
585
|
+
inputs: [{
|
|
586
|
+
name: "_tiers",
|
|
587
|
+
type: "tuple[]",
|
|
588
|
+
internalType: "struct LibAppStorage.FeeTier[]",
|
|
589
|
+
components: [
|
|
590
|
+
{ name: "minCR", type: "uint256", internalType: "uint256" },
|
|
591
|
+
{ name: "apUSDMintFee", type: "uint16", internalType: "uint16" },
|
|
592
|
+
{ name: "apUSDRedeemFee", type: "uint16", internalType: "uint16" },
|
|
593
|
+
{ name: "xBNBMintFee", type: "uint16", internalType: "uint16" },
|
|
594
|
+
{ name: "xBNBRedeemFee", type: "uint16", internalType: "uint16" },
|
|
595
|
+
{ name: "apUSDMintDisabled", type: "bool", internalType: "bool" }
|
|
596
|
+
]
|
|
597
|
+
}],
|
|
598
|
+
outputs: [],
|
|
599
|
+
stateMutability: "nonpayable"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
type: "event",
|
|
603
|
+
name: "FeeManagerSet",
|
|
604
|
+
inputs: [
|
|
605
|
+
{ name: "feeManager", type: "address", indexed: true, internalType: "address" }
|
|
606
|
+
],
|
|
607
|
+
anonymous: false
|
|
534
608
|
}
|
|
535
609
|
] as const;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SApUSD (Staked ApUSD) Vault ABI
|
|
3
|
+
* Multi-asset vault for staking apUSD and absorbing xBNB during stability events
|
|
4
|
+
*/
|
|
5
|
+
export const SApUSDABI = [
|
|
6
|
+
// ============ View Functions ============
|
|
7
|
+
{
|
|
8
|
+
type: "function",
|
|
9
|
+
name: "totalAssets",
|
|
10
|
+
inputs: [],
|
|
11
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "totalSupply",
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
19
|
+
stateMutability: "view"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: "function",
|
|
23
|
+
name: "balanceOf",
|
|
24
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
25
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
26
|
+
stateMutability: "view"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "function",
|
|
30
|
+
name: "hasStabilityConversion",
|
|
31
|
+
inputs: [],
|
|
32
|
+
outputs: [
|
|
33
|
+
{ name: "hasXBNB", type: "bool", internalType: "bool" },
|
|
34
|
+
{ name: "xBNBAmount", type: "uint256", internalType: "uint256" }
|
|
35
|
+
],
|
|
36
|
+
stateMutability: "view"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "function",
|
|
40
|
+
name: "exchangeRate",
|
|
41
|
+
inputs: [],
|
|
42
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
43
|
+
stateMutability: "view"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: "function",
|
|
47
|
+
name: "previewCleanXBNB",
|
|
48
|
+
inputs: [
|
|
49
|
+
{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" },
|
|
50
|
+
{ name: "_router", type: "address", internalType: "address" },
|
|
51
|
+
{ name: "_path", type: "address[]", internalType: "address[]" }
|
|
52
|
+
],
|
|
53
|
+
outputs: [{ name: "expectedApUSD", type: "uint256", internalType: "uint256" }],
|
|
54
|
+
stateMutability: "view"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "function",
|
|
58
|
+
name: "KEEPER_ROLE",
|
|
59
|
+
inputs: [],
|
|
60
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
61
|
+
stateMutability: "view"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "function",
|
|
65
|
+
name: "hasRole",
|
|
66
|
+
inputs: [
|
|
67
|
+
{ name: "role", type: "bytes32", internalType: "bytes32" },
|
|
68
|
+
{ name: "account", type: "address", internalType: "address" }
|
|
69
|
+
],
|
|
70
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
71
|
+
stateMutability: "view"
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// ============ Keeper Functions ============
|
|
75
|
+
{
|
|
76
|
+
type: "function",
|
|
77
|
+
name: "cleanXBNB",
|
|
78
|
+
inputs: [
|
|
79
|
+
{ name: "_xBNBAmount", type: "uint256", internalType: "uint256" },
|
|
80
|
+
{ name: "_minApUSDOut", type: "uint256", internalType: "uint256" },
|
|
81
|
+
{ name: "_router", type: "address", internalType: "address" },
|
|
82
|
+
{ name: "_path", type: "address[]", internalType: "address[]" },
|
|
83
|
+
{ name: "_deadline", type: "uint256", internalType: "uint256" }
|
|
84
|
+
],
|
|
85
|
+
outputs: [{ name: "apUSDReceived", type: "uint256", internalType: "uint256" }],
|
|
86
|
+
stateMutability: "nonpayable"
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// ============ Events ============
|
|
90
|
+
{
|
|
91
|
+
type: "event",
|
|
92
|
+
name: "VaultCleaned",
|
|
93
|
+
inputs: [
|
|
94
|
+
{ name: "xBNBSold", type: "uint256", indexed: false, internalType: "uint256" },
|
|
95
|
+
{ name: "apUSDReceived", type: "uint256", indexed: false, internalType: "uint256" },
|
|
96
|
+
{ name: "keeper", type: "address", indexed: true, internalType: "address" }
|
|
97
|
+
],
|
|
98
|
+
anonymous: false
|
|
99
|
+
}
|
|
100
|
+
] as const;
|