@kasufinance/kasu-sdk 2.1.0 → 2.2.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/dist/bundle.cjs.js +69 -27
- package/dist/bundle.esm.js +69 -27
- package/dist/facade/chain-configs.d.ts +1 -1
- package/dist/facade/chain-configs.js +23 -0
- package/dist/facade/chain-configs.js.map +1 -1
- package/dist/facade/deposits.d.ts +2 -2
- package/dist/facade/deposits.js +3 -3
- package/dist/facade/deposits.js.map +1 -1
- package/dist/facade/types.d.ts +9 -9
- package/dist/sdk-config.d.ts +6 -0
- package/dist/sdk-config.js +2 -1
- package/dist/sdk-config.js.map +1 -1
- package/dist/services/DataService/data-service.js +1 -1
- package/dist/services/DataService/data-service.js.map +1 -1
- package/dist/services/Locking/locking.d.ts +5 -1
- package/dist/services/Locking/locking.js +25 -13
- package/dist/services/Locking/locking.js.map +1 -1
- package/dist/services/Locking/types.d.ts +1 -1
- package/dist/services/Portfolio/portfolio.d.ts +2 -2
- package/dist/services/Portfolio/portfolio.js +6 -6
- package/dist/services/Portfolio/portfolio.js.map +1 -1
- package/dist/services/Portfolio/types.d.ts +2 -2
- package/dist/services/UserLending/user-lending.d.ts +3 -1
- package/dist/services/UserLending/user-lending.js +9 -3
- package/dist/services/UserLending/user-lending.js.map +1 -1
- package/package.json +1 -1
- package/src/facade/chain-configs.ts +26 -1
- package/src/facade/deposits.ts +3 -3
- package/src/facade/types.ts +9 -9
- package/src/sdk-config.ts +7 -0
- package/src/services/DataService/data-service.ts +1 -1
- package/src/services/Locking/locking.ts +28 -13
- package/src/services/Locking/types.ts +1 -1
- package/src/services/Portfolio/portfolio.ts +6 -6
- package/src/services/Portfolio/types.ts +2 -2
- package/src/services/UserLending/user-lending.ts +13 -4
- package/.claude/settings.local.json +0 -15
package/dist/bundle.cjs.js
CHANGED
|
@@ -15845,7 +15845,7 @@ class DataService {
|
|
|
15845
15845
|
];
|
|
15846
15846
|
})));
|
|
15847
15847
|
for (const [id, tvl] of results) {
|
|
15848
|
-
tvlMap.set(id, utils$2.formatUnits(tvl,
|
|
15848
|
+
tvlMap.set(id, utils$2.formatUnits(tvl, this._kasuConfig.stableAssetDecimals));
|
|
15849
15849
|
}
|
|
15850
15850
|
}
|
|
15851
15851
|
catch (error) {
|
|
@@ -16512,13 +16512,13 @@ class KSULocking {
|
|
|
16512
16512
|
});
|
|
16513
16513
|
const resultPromises = result.userLocks.map((userLock) => __awaiter(this, void 0, void 0, function* () {
|
|
16514
16514
|
const [, id] = userLock.id.split('-');
|
|
16515
|
-
const
|
|
16516
|
-
const loyaltyStatus = this.getLoyaltyLevelAndApyBonusFromRatio(
|
|
16515
|
+
const rKSUtoStableRatio = yield this.getRKSUvsStableRatio(userLock.rKSUAmount, userAddress);
|
|
16516
|
+
const loyaltyStatus = this.getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio);
|
|
16517
16517
|
return {
|
|
16518
16518
|
id: ethers.BigNumber.from(id),
|
|
16519
16519
|
lockedAmount: userLock.ksuAmount,
|
|
16520
16520
|
rKSUAmount: userLock.rKSUAmount,
|
|
16521
|
-
|
|
16521
|
+
rKSUtoStableRatio: rKSUtoStableRatio,
|
|
16522
16522
|
apyBonus: loyaltyStatus.apyBonus,
|
|
16523
16523
|
loyaltyLevel: loyaltyStatus.loyaltyLevel,
|
|
16524
16524
|
startTime: parseFloat(userLock.startTimestamp),
|
|
@@ -16571,20 +16571,20 @@ class KSULocking {
|
|
|
16571
16571
|
};
|
|
16572
16572
|
});
|
|
16573
16573
|
}
|
|
16574
|
-
getLoyaltyLevelAndApyBonusFromRatio(
|
|
16574
|
+
getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio) {
|
|
16575
16575
|
// On Lite deployments, always return level 0 with no bonus
|
|
16576
16576
|
if (this._isLiteDeployment) {
|
|
16577
16577
|
return { loyaltyLevel: 0, apyBonus: 0 };
|
|
16578
16578
|
}
|
|
16579
|
-
if (
|
|
16579
|
+
if (rKSUtoStableRatio < 0.01) {
|
|
16580
16580
|
return { loyaltyLevel: 0, apyBonus: this.apyBonuses[0] };
|
|
16581
16581
|
}
|
|
16582
|
-
else if (
|
|
16582
|
+
else if (rKSUtoStableRatio < 0.05) {
|
|
16583
16583
|
return { loyaltyLevel: 1, apyBonus: this.apyBonuses[1] };
|
|
16584
16584
|
}
|
|
16585
16585
|
return { loyaltyLevel: 2, apyBonus: this.apyBonuses[2] };
|
|
16586
16586
|
}
|
|
16587
|
-
|
|
16587
|
+
getRKSUvsStableRatio(rKSUAmount, userAddress) {
|
|
16588
16588
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16589
16589
|
if (this._isLiteDeployment) {
|
|
16590
16590
|
return 0;
|
|
@@ -16592,12 +16592,20 @@ class KSULocking {
|
|
|
16592
16592
|
const [depositedAmount, pendingAmount] = yield this._userManagerAbi.userTotalPendingAndActiveDepositedAmountForCurrentEpoch(userAddress);
|
|
16593
16593
|
const ksuPrice = yield this._systemVariablesAbi.ksuEpochTokenPrice();
|
|
16594
16594
|
const rKSUAmountBignumber = ethers.ethers.utils.parseUnits(rKSUAmount, 18);
|
|
16595
|
-
const
|
|
16596
|
-
|
|
16595
|
+
const totalUserStableAmount = depositedAmount.toNumber() + pendingAmount.toNumber();
|
|
16596
|
+
// Convert rKSU value to stable asset units: rKSU * ksuPrice / 1e18 / 1e(18 - stableDecimals)
|
|
16597
|
+
const decimalDiff = 18 - this._kasuConfig.stableAssetDecimals;
|
|
16598
|
+
const rKSUInStable = rKSUAmountBignumber
|
|
16597
16599
|
.mul(ksuPrice)
|
|
16598
16600
|
.div(ethers.ethers.utils.parseUnits('1', 18))
|
|
16599
|
-
.div(ethers.ethers.utils.parseUnits('1',
|
|
16600
|
-
return
|
|
16601
|
+
.div(ethers.ethers.utils.parseUnits('1', decimalDiff));
|
|
16602
|
+
return rKSUInStable.toNumber() / totalUserStableAmount;
|
|
16603
|
+
});
|
|
16604
|
+
}
|
|
16605
|
+
/** @deprecated Use `getRKSUvsStableRatio` instead. */
|
|
16606
|
+
getRKSUvsUSDCRatio(rKSUAmount, userAddress) {
|
|
16607
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16608
|
+
return this.getRKSUvsStableRatio(rKSUAmount, userAddress);
|
|
16601
16609
|
});
|
|
16602
16610
|
}
|
|
16603
16611
|
getClaimableRewards(userAddress) {
|
|
@@ -16707,7 +16715,7 @@ class KSULocking {
|
|
|
16707
16715
|
lifeTimeRewards: '0',
|
|
16708
16716
|
};
|
|
16709
16717
|
}
|
|
16710
|
-
const rewardDecimals =
|
|
16718
|
+
const rewardDecimals = this._kasuConfig.stableAssetDecimals;
|
|
16711
16719
|
const claimableRewards = yield this.getClaimableRewards(userAddress);
|
|
16712
16720
|
const lifeTimeRewards = yield this.getLifetimeRewards(userAddress, rewardDecimals, claimableRewards);
|
|
16713
16721
|
return {
|
|
@@ -16771,9 +16779,13 @@ class KSULocking {
|
|
|
16771
16779
|
getProjectedApy() {
|
|
16772
16780
|
return '10.00';
|
|
16773
16781
|
}
|
|
16774
|
-
|
|
16782
|
+
getProjectedStableAmount() {
|
|
16775
16783
|
return '20.00';
|
|
16776
16784
|
}
|
|
16785
|
+
/** @deprecated Use `getProjectedStableAmount` instead. */
|
|
16786
|
+
getProjectedUSDC() {
|
|
16787
|
+
return this.getProjectedStableAmount();
|
|
16788
|
+
}
|
|
16777
16789
|
}
|
|
16778
16790
|
|
|
16779
16791
|
/**
|
|
@@ -17076,13 +17088,19 @@ class UserLending {
|
|
|
17076
17088
|
return yield this._lendingPoolManagerAbi.requestWithdrawal(lendingPool, tranche, amount);
|
|
17077
17089
|
});
|
|
17078
17090
|
}
|
|
17079
|
-
|
|
17091
|
+
requestWithdrawalInAsset(lendingPool, tranche, assetAmount) {
|
|
17080
17092
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17081
17093
|
const trancheContract = ILendingPoolTrancheAbi__factory.connect(tranche, this._signerOrProvider);
|
|
17082
|
-
const shareAmount = yield trancheContract.convertToShares(
|
|
17094
|
+
const shareAmount = yield trancheContract.convertToShares(assetAmount);
|
|
17083
17095
|
return yield this._lendingPoolManagerAbi.requestWithdrawal(lendingPool, tranche, shareAmount);
|
|
17084
17096
|
});
|
|
17085
17097
|
}
|
|
17098
|
+
/** @deprecated Use `requestWithdrawalInAsset` instead. */
|
|
17099
|
+
requestWithdrawalInUSDC(lendingPool, tranche, amount) {
|
|
17100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17101
|
+
return this.requestWithdrawalInAsset(lendingPool, tranche, amount);
|
|
17102
|
+
});
|
|
17103
|
+
}
|
|
17086
17104
|
requestWithdrawalMax(lendingPool, tranche, user) {
|
|
17087
17105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17088
17106
|
const trancheContract = ILendingPoolTrancheAbi__factory.connect(tranche, this._signerOrProvider);
|
|
@@ -17364,7 +17382,7 @@ class UserLending {
|
|
|
17364
17382
|
lendingPool.id.toLowerCase())) === null || _a === void 0 ? void 0 : _a.balance) !== null && _b !== void 0 ? _b : ethers.BigNumber.from(0);
|
|
17365
17383
|
return {
|
|
17366
17384
|
poolId: lendingPool.id,
|
|
17367
|
-
yieldEarned: parseFloat(ethers.ethers.utils.formatUnits(balance,
|
|
17385
|
+
yieldEarned: parseFloat(ethers.ethers.utils.formatUnits(balance, this._kasuConfig.stableAssetDecimals)) -
|
|
17368
17386
|
parseFloat(totalAcceptedDeposits) -
|
|
17369
17387
|
-parseFloat(totalAcceptedWithdrawnAmount),
|
|
17370
17388
|
balance,
|
|
@@ -17685,8 +17703,8 @@ class Portfolio {
|
|
|
17685
17703
|
return this.computeYieldMetrics(portfolioLendingPools);
|
|
17686
17704
|
}
|
|
17687
17705
|
/**
|
|
17688
|
-
* Calculate the user's weekly protocol fee share (
|
|
17689
|
-
* system variables and locking summary. All inputs are expected to be pre-fetched.
|
|
17706
|
+
* Calculate the user's weekly protocol fee share (in stable asset units) given tranche
|
|
17707
|
+
* balances/configs, system variables and locking summary. All inputs are expected to be pre-fetched.
|
|
17690
17708
|
*/
|
|
17691
17709
|
calculateWeeklyProtocolFees(params) {
|
|
17692
17710
|
var _a, _b;
|
|
@@ -17728,8 +17746,8 @@ class Portfolio {
|
|
|
17728
17746
|
const totalUserDeposits = userDepositAmounts[0].add(userDepositAmounts[1]);
|
|
17729
17747
|
if (totalUserDeposits.isZero())
|
|
17730
17748
|
return 0;
|
|
17731
|
-
const
|
|
17732
|
-
const { loyaltyLevel } = this._lockingService.getLoyaltyLevelAndApyBonusFromRatio(
|
|
17749
|
+
const rKSUtoStableRatio = yield this._lockingService.getRKSUvsStableRatio(userRksuAmount, userAddress);
|
|
17750
|
+
const { loyaltyLevel } = this._lockingService.getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio);
|
|
17733
17751
|
const loyaltyRewardRate = yield this._userLoyaltyRewardsAbi.loyaltyEpochRewardRates(loyaltyLevel);
|
|
17734
17752
|
if (loyaltyRewardRate.isZero() || ksuEpochPrice.price.isZero()) {
|
|
17735
17753
|
return 0;
|
|
@@ -17757,9 +17775,9 @@ class Portfolio {
|
|
|
17757
17775
|
},
|
|
17758
17776
|
protocolFees: {
|
|
17759
17777
|
claimableBalance: {
|
|
17760
|
-
|
|
17778
|
+
stableAmount: lockingRewards.claimableRewards,
|
|
17761
17779
|
},
|
|
17762
|
-
lifeTime: {
|
|
17780
|
+
lifeTime: { stableAmount: lockingRewards.lifeTimeRewards },
|
|
17763
17781
|
},
|
|
17764
17782
|
ksuLaunchBonus: { lifeTime: { ksuAmount: ksuLaunchBonus } },
|
|
17765
17783
|
};
|
|
@@ -21873,13 +21891,14 @@ class KasuSdk {
|
|
|
21873
21891
|
|
|
21874
21892
|
class SdkConfig {
|
|
21875
21893
|
constructor(options) {
|
|
21876
|
-
var _a, _b, _c;
|
|
21894
|
+
var _a, _b, _c, _d;
|
|
21877
21895
|
this.subgraphUrl = options.subgraphUrl;
|
|
21878
21896
|
this.contracts = options.contracts;
|
|
21879
21897
|
this.directusUrl = (_a = options.directusUrl) !== null && _a !== void 0 ? _a : '';
|
|
21880
21898
|
this.UNUSED_LENDING_POOL_IDS = options.UNUSED_LENDING_POOL_IDS;
|
|
21881
21899
|
this.isLiteDeployment = (_b = options.isLiteDeployment) !== null && _b !== void 0 ? _b : false;
|
|
21882
21900
|
this.poolMetadataMapping = (_c = options.poolMetadataMapping) !== null && _c !== void 0 ? _c : {};
|
|
21901
|
+
this.stableAssetDecimals = (_d = options.stableAssetDecimals) !== null && _d !== void 0 ? _d : 6;
|
|
21883
21902
|
}
|
|
21884
21903
|
}
|
|
21885
21904
|
|
|
@@ -21943,6 +21962,29 @@ const CHAIN_CONFIGS = {
|
|
|
21943
21962
|
'0xeda50c91a8c4ca8a83652b8542c0b3bd00a71fad': '0xc347a9e4aec8c8d11a149d2907deb2bf23b81c6f',
|
|
21944
21963
|
},
|
|
21945
21964
|
},
|
|
21965
|
+
'xdc-usdc': {
|
|
21966
|
+
chainId: 50,
|
|
21967
|
+
name: 'XDC Mainnet (USDC)',
|
|
21968
|
+
isLiteDeployment: true,
|
|
21969
|
+
contracts: {
|
|
21970
|
+
// No KSUToken on Lite deployments
|
|
21971
|
+
IKSULocking: '0x47e7C147955FAC86c4AeAe5a8691C1A702A9C4FA',
|
|
21972
|
+
IKSULockBonus: '0xe99c77d800E1065f2f1Ab23A6D70cBc7D1102943',
|
|
21973
|
+
LendingPoolManager: '0x5ba223175F61221fbc795F71a41f52Bff825C68b',
|
|
21974
|
+
UserManager: '0xFd407a09049C4d60a81C708E5587B8C7b6Cf6BdD',
|
|
21975
|
+
KasuAllowList: '0xaf911547FD38686a88fc26B2A722F870426bCD6D',
|
|
21976
|
+
SystemVariables: '0xb73Ebe67c8597d55A5F4FCc2C1638eDd5512BfBb',
|
|
21977
|
+
KsuPrice: '0xA622DE9d439C05266C63EfeA3B7853792aD61f45',
|
|
21978
|
+
UserLoyaltyRewards: '0x8e2033DcF9C6D3B9D3B24C651a03c0Af65A113b8',
|
|
21979
|
+
ClearingCoordinator: '0x84022117eAD4C22D8A01bC7Fc9743dd101C6a882',
|
|
21980
|
+
// No KasuNFTs on Lite deployments
|
|
21981
|
+
ExternalTVL: '0xb2367F0B074Ec1788b28283A8af953aaA498d779',
|
|
21982
|
+
},
|
|
21983
|
+
subgraphUrl: 'https://api.goldsky.com/api/public/project_cmgzlpxm300765np2a19421om/subgraphs/kasu-xdc-usdc/v1.0.0/gn',
|
|
21984
|
+
directusUrl: 'https://kasu-finance.directus.app/',
|
|
21985
|
+
unusedPoolIds: [],
|
|
21986
|
+
poolMetadataMapping: undefined,
|
|
21987
|
+
},
|
|
21946
21988
|
plume: {
|
|
21947
21989
|
chainId: 98866,
|
|
21948
21990
|
name: 'Plume Mainnet',
|
|
@@ -21990,7 +22032,7 @@ class DepositsFacade {
|
|
|
21990
22032
|
* const tx = await kasu.deposits.deposit({
|
|
21991
22033
|
* poolId: '0x...',
|
|
21992
22034
|
* trancheId: '0x...',
|
|
21993
|
-
* amount: parseUnits('1000', 6),
|
|
22035
|
+
* amount: parseUnits('1000', 6), // 6 decimals for USDC/AUDD; use token's actual decimals
|
|
21994
22036
|
* kycSignature: { blockExpiration, signature },
|
|
21995
22037
|
* });
|
|
21996
22038
|
* ```
|
|
@@ -22002,11 +22044,11 @@ class DepositsFacade {
|
|
|
22002
22044
|
});
|
|
22003
22045
|
}
|
|
22004
22046
|
/**
|
|
22005
|
-
* Submit a withdrawal request for a specific
|
|
22047
|
+
* Submit a withdrawal request for a specific stable asset amount.
|
|
22006
22048
|
*/
|
|
22007
22049
|
withdraw(params) {
|
|
22008
22050
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22009
|
-
return yield this._userLending.
|
|
22051
|
+
return yield this._userLending.requestWithdrawalInAsset(params.poolId, params.trancheId, params.amount);
|
|
22010
22052
|
});
|
|
22011
22053
|
}
|
|
22012
22054
|
/**
|
package/dist/bundle.esm.js
CHANGED
|
@@ -15843,7 +15843,7 @@ class DataService {
|
|
|
15843
15843
|
];
|
|
15844
15844
|
})));
|
|
15845
15845
|
for (const [id, tvl] of results) {
|
|
15846
|
-
tvlMap.set(id, formatUnits(tvl,
|
|
15846
|
+
tvlMap.set(id, formatUnits(tvl, this._kasuConfig.stableAssetDecimals));
|
|
15847
15847
|
}
|
|
15848
15848
|
}
|
|
15849
15849
|
catch (error) {
|
|
@@ -16510,13 +16510,13 @@ class KSULocking {
|
|
|
16510
16510
|
});
|
|
16511
16511
|
const resultPromises = result.userLocks.map((userLock) => __awaiter(this, void 0, void 0, function* () {
|
|
16512
16512
|
const [, id] = userLock.id.split('-');
|
|
16513
|
-
const
|
|
16514
|
-
const loyaltyStatus = this.getLoyaltyLevelAndApyBonusFromRatio(
|
|
16513
|
+
const rKSUtoStableRatio = yield this.getRKSUvsStableRatio(userLock.rKSUAmount, userAddress);
|
|
16514
|
+
const loyaltyStatus = this.getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio);
|
|
16515
16515
|
return {
|
|
16516
16516
|
id: BigNumber.from(id),
|
|
16517
16517
|
lockedAmount: userLock.ksuAmount,
|
|
16518
16518
|
rKSUAmount: userLock.rKSUAmount,
|
|
16519
|
-
|
|
16519
|
+
rKSUtoStableRatio: rKSUtoStableRatio,
|
|
16520
16520
|
apyBonus: loyaltyStatus.apyBonus,
|
|
16521
16521
|
loyaltyLevel: loyaltyStatus.loyaltyLevel,
|
|
16522
16522
|
startTime: parseFloat(userLock.startTimestamp),
|
|
@@ -16569,20 +16569,20 @@ class KSULocking {
|
|
|
16569
16569
|
};
|
|
16570
16570
|
});
|
|
16571
16571
|
}
|
|
16572
|
-
getLoyaltyLevelAndApyBonusFromRatio(
|
|
16572
|
+
getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio) {
|
|
16573
16573
|
// On Lite deployments, always return level 0 with no bonus
|
|
16574
16574
|
if (this._isLiteDeployment) {
|
|
16575
16575
|
return { loyaltyLevel: 0, apyBonus: 0 };
|
|
16576
16576
|
}
|
|
16577
|
-
if (
|
|
16577
|
+
if (rKSUtoStableRatio < 0.01) {
|
|
16578
16578
|
return { loyaltyLevel: 0, apyBonus: this.apyBonuses[0] };
|
|
16579
16579
|
}
|
|
16580
|
-
else if (
|
|
16580
|
+
else if (rKSUtoStableRatio < 0.05) {
|
|
16581
16581
|
return { loyaltyLevel: 1, apyBonus: this.apyBonuses[1] };
|
|
16582
16582
|
}
|
|
16583
16583
|
return { loyaltyLevel: 2, apyBonus: this.apyBonuses[2] };
|
|
16584
16584
|
}
|
|
16585
|
-
|
|
16585
|
+
getRKSUvsStableRatio(rKSUAmount, userAddress) {
|
|
16586
16586
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16587
16587
|
if (this._isLiteDeployment) {
|
|
16588
16588
|
return 0;
|
|
@@ -16590,12 +16590,20 @@ class KSULocking {
|
|
|
16590
16590
|
const [depositedAmount, pendingAmount] = yield this._userManagerAbi.userTotalPendingAndActiveDepositedAmountForCurrentEpoch(userAddress);
|
|
16591
16591
|
const ksuPrice = yield this._systemVariablesAbi.ksuEpochTokenPrice();
|
|
16592
16592
|
const rKSUAmountBignumber = ethers.utils.parseUnits(rKSUAmount, 18);
|
|
16593
|
-
const
|
|
16594
|
-
|
|
16593
|
+
const totalUserStableAmount = depositedAmount.toNumber() + pendingAmount.toNumber();
|
|
16594
|
+
// Convert rKSU value to stable asset units: rKSU * ksuPrice / 1e18 / 1e(18 - stableDecimals)
|
|
16595
|
+
const decimalDiff = 18 - this._kasuConfig.stableAssetDecimals;
|
|
16596
|
+
const rKSUInStable = rKSUAmountBignumber
|
|
16595
16597
|
.mul(ksuPrice)
|
|
16596
16598
|
.div(ethers.utils.parseUnits('1', 18))
|
|
16597
|
-
.div(ethers.utils.parseUnits('1',
|
|
16598
|
-
return
|
|
16599
|
+
.div(ethers.utils.parseUnits('1', decimalDiff));
|
|
16600
|
+
return rKSUInStable.toNumber() / totalUserStableAmount;
|
|
16601
|
+
});
|
|
16602
|
+
}
|
|
16603
|
+
/** @deprecated Use `getRKSUvsStableRatio` instead. */
|
|
16604
|
+
getRKSUvsUSDCRatio(rKSUAmount, userAddress) {
|
|
16605
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16606
|
+
return this.getRKSUvsStableRatio(rKSUAmount, userAddress);
|
|
16599
16607
|
});
|
|
16600
16608
|
}
|
|
16601
16609
|
getClaimableRewards(userAddress) {
|
|
@@ -16705,7 +16713,7 @@ class KSULocking {
|
|
|
16705
16713
|
lifeTimeRewards: '0',
|
|
16706
16714
|
};
|
|
16707
16715
|
}
|
|
16708
|
-
const rewardDecimals =
|
|
16716
|
+
const rewardDecimals = this._kasuConfig.stableAssetDecimals;
|
|
16709
16717
|
const claimableRewards = yield this.getClaimableRewards(userAddress);
|
|
16710
16718
|
const lifeTimeRewards = yield this.getLifetimeRewards(userAddress, rewardDecimals, claimableRewards);
|
|
16711
16719
|
return {
|
|
@@ -16769,9 +16777,13 @@ class KSULocking {
|
|
|
16769
16777
|
getProjectedApy() {
|
|
16770
16778
|
return '10.00';
|
|
16771
16779
|
}
|
|
16772
|
-
|
|
16780
|
+
getProjectedStableAmount() {
|
|
16773
16781
|
return '20.00';
|
|
16774
16782
|
}
|
|
16783
|
+
/** @deprecated Use `getProjectedStableAmount` instead. */
|
|
16784
|
+
getProjectedUSDC() {
|
|
16785
|
+
return this.getProjectedStableAmount();
|
|
16786
|
+
}
|
|
16775
16787
|
}
|
|
16776
16788
|
|
|
16777
16789
|
/**
|
|
@@ -17074,13 +17086,19 @@ class UserLending {
|
|
|
17074
17086
|
return yield this._lendingPoolManagerAbi.requestWithdrawal(lendingPool, tranche, amount);
|
|
17075
17087
|
});
|
|
17076
17088
|
}
|
|
17077
|
-
|
|
17089
|
+
requestWithdrawalInAsset(lendingPool, tranche, assetAmount) {
|
|
17078
17090
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17079
17091
|
const trancheContract = ILendingPoolTrancheAbi__factory.connect(tranche, this._signerOrProvider);
|
|
17080
|
-
const shareAmount = yield trancheContract.convertToShares(
|
|
17092
|
+
const shareAmount = yield trancheContract.convertToShares(assetAmount);
|
|
17081
17093
|
return yield this._lendingPoolManagerAbi.requestWithdrawal(lendingPool, tranche, shareAmount);
|
|
17082
17094
|
});
|
|
17083
17095
|
}
|
|
17096
|
+
/** @deprecated Use `requestWithdrawalInAsset` instead. */
|
|
17097
|
+
requestWithdrawalInUSDC(lendingPool, tranche, amount) {
|
|
17098
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17099
|
+
return this.requestWithdrawalInAsset(lendingPool, tranche, amount);
|
|
17100
|
+
});
|
|
17101
|
+
}
|
|
17084
17102
|
requestWithdrawalMax(lendingPool, tranche, user) {
|
|
17085
17103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17086
17104
|
const trancheContract = ILendingPoolTrancheAbi__factory.connect(tranche, this._signerOrProvider);
|
|
@@ -17362,7 +17380,7 @@ class UserLending {
|
|
|
17362
17380
|
lendingPool.id.toLowerCase())) === null || _a === void 0 ? void 0 : _a.balance) !== null && _b !== void 0 ? _b : BigNumber.from(0);
|
|
17363
17381
|
return {
|
|
17364
17382
|
poolId: lendingPool.id,
|
|
17365
|
-
yieldEarned: parseFloat(ethers.utils.formatUnits(balance,
|
|
17383
|
+
yieldEarned: parseFloat(ethers.utils.formatUnits(balance, this._kasuConfig.stableAssetDecimals)) -
|
|
17366
17384
|
parseFloat(totalAcceptedDeposits) -
|
|
17367
17385
|
-parseFloat(totalAcceptedWithdrawnAmount),
|
|
17368
17386
|
balance,
|
|
@@ -17683,8 +17701,8 @@ class Portfolio {
|
|
|
17683
17701
|
return this.computeYieldMetrics(portfolioLendingPools);
|
|
17684
17702
|
}
|
|
17685
17703
|
/**
|
|
17686
|
-
* Calculate the user's weekly protocol fee share (
|
|
17687
|
-
* system variables and locking summary. All inputs are expected to be pre-fetched.
|
|
17704
|
+
* Calculate the user's weekly protocol fee share (in stable asset units) given tranche
|
|
17705
|
+
* balances/configs, system variables and locking summary. All inputs are expected to be pre-fetched.
|
|
17688
17706
|
*/
|
|
17689
17707
|
calculateWeeklyProtocolFees(params) {
|
|
17690
17708
|
var _a, _b;
|
|
@@ -17726,8 +17744,8 @@ class Portfolio {
|
|
|
17726
17744
|
const totalUserDeposits = userDepositAmounts[0].add(userDepositAmounts[1]);
|
|
17727
17745
|
if (totalUserDeposits.isZero())
|
|
17728
17746
|
return 0;
|
|
17729
|
-
const
|
|
17730
|
-
const { loyaltyLevel } = this._lockingService.getLoyaltyLevelAndApyBonusFromRatio(
|
|
17747
|
+
const rKSUtoStableRatio = yield this._lockingService.getRKSUvsStableRatio(userRksuAmount, userAddress);
|
|
17748
|
+
const { loyaltyLevel } = this._lockingService.getLoyaltyLevelAndApyBonusFromRatio(rKSUtoStableRatio);
|
|
17731
17749
|
const loyaltyRewardRate = yield this._userLoyaltyRewardsAbi.loyaltyEpochRewardRates(loyaltyLevel);
|
|
17732
17750
|
if (loyaltyRewardRate.isZero() || ksuEpochPrice.price.isZero()) {
|
|
17733
17751
|
return 0;
|
|
@@ -17755,9 +17773,9 @@ class Portfolio {
|
|
|
17755
17773
|
},
|
|
17756
17774
|
protocolFees: {
|
|
17757
17775
|
claimableBalance: {
|
|
17758
|
-
|
|
17776
|
+
stableAmount: lockingRewards.claimableRewards,
|
|
17759
17777
|
},
|
|
17760
|
-
lifeTime: {
|
|
17778
|
+
lifeTime: { stableAmount: lockingRewards.lifeTimeRewards },
|
|
17761
17779
|
},
|
|
17762
17780
|
ksuLaunchBonus: { lifeTime: { ksuAmount: ksuLaunchBonus } },
|
|
17763
17781
|
};
|
|
@@ -21871,13 +21889,14 @@ class KasuSdk {
|
|
|
21871
21889
|
|
|
21872
21890
|
class SdkConfig {
|
|
21873
21891
|
constructor(options) {
|
|
21874
|
-
var _a, _b, _c;
|
|
21892
|
+
var _a, _b, _c, _d;
|
|
21875
21893
|
this.subgraphUrl = options.subgraphUrl;
|
|
21876
21894
|
this.contracts = options.contracts;
|
|
21877
21895
|
this.directusUrl = (_a = options.directusUrl) !== null && _a !== void 0 ? _a : '';
|
|
21878
21896
|
this.UNUSED_LENDING_POOL_IDS = options.UNUSED_LENDING_POOL_IDS;
|
|
21879
21897
|
this.isLiteDeployment = (_b = options.isLiteDeployment) !== null && _b !== void 0 ? _b : false;
|
|
21880
21898
|
this.poolMetadataMapping = (_c = options.poolMetadataMapping) !== null && _c !== void 0 ? _c : {};
|
|
21899
|
+
this.stableAssetDecimals = (_d = options.stableAssetDecimals) !== null && _d !== void 0 ? _d : 6;
|
|
21881
21900
|
}
|
|
21882
21901
|
}
|
|
21883
21902
|
|
|
@@ -21941,6 +21960,29 @@ const CHAIN_CONFIGS = {
|
|
|
21941
21960
|
'0xeda50c91a8c4ca8a83652b8542c0b3bd00a71fad': '0xc347a9e4aec8c8d11a149d2907deb2bf23b81c6f',
|
|
21942
21961
|
},
|
|
21943
21962
|
},
|
|
21963
|
+
'xdc-usdc': {
|
|
21964
|
+
chainId: 50,
|
|
21965
|
+
name: 'XDC Mainnet (USDC)',
|
|
21966
|
+
isLiteDeployment: true,
|
|
21967
|
+
contracts: {
|
|
21968
|
+
// No KSUToken on Lite deployments
|
|
21969
|
+
IKSULocking: '0x47e7C147955FAC86c4AeAe5a8691C1A702A9C4FA',
|
|
21970
|
+
IKSULockBonus: '0xe99c77d800E1065f2f1Ab23A6D70cBc7D1102943',
|
|
21971
|
+
LendingPoolManager: '0x5ba223175F61221fbc795F71a41f52Bff825C68b',
|
|
21972
|
+
UserManager: '0xFd407a09049C4d60a81C708E5587B8C7b6Cf6BdD',
|
|
21973
|
+
KasuAllowList: '0xaf911547FD38686a88fc26B2A722F870426bCD6D',
|
|
21974
|
+
SystemVariables: '0xb73Ebe67c8597d55A5F4FCc2C1638eDd5512BfBb',
|
|
21975
|
+
KsuPrice: '0xA622DE9d439C05266C63EfeA3B7853792aD61f45',
|
|
21976
|
+
UserLoyaltyRewards: '0x8e2033DcF9C6D3B9D3B24C651a03c0Af65A113b8',
|
|
21977
|
+
ClearingCoordinator: '0x84022117eAD4C22D8A01bC7Fc9743dd101C6a882',
|
|
21978
|
+
// No KasuNFTs on Lite deployments
|
|
21979
|
+
ExternalTVL: '0xb2367F0B074Ec1788b28283A8af953aaA498d779',
|
|
21980
|
+
},
|
|
21981
|
+
subgraphUrl: 'https://api.goldsky.com/api/public/project_cmgzlpxm300765np2a19421om/subgraphs/kasu-xdc-usdc/v1.0.0/gn',
|
|
21982
|
+
directusUrl: 'https://kasu-finance.directus.app/',
|
|
21983
|
+
unusedPoolIds: [],
|
|
21984
|
+
poolMetadataMapping: undefined,
|
|
21985
|
+
},
|
|
21944
21986
|
plume: {
|
|
21945
21987
|
chainId: 98866,
|
|
21946
21988
|
name: 'Plume Mainnet',
|
|
@@ -21988,7 +22030,7 @@ class DepositsFacade {
|
|
|
21988
22030
|
* const tx = await kasu.deposits.deposit({
|
|
21989
22031
|
* poolId: '0x...',
|
|
21990
22032
|
* trancheId: '0x...',
|
|
21991
|
-
* amount: parseUnits('1000', 6),
|
|
22033
|
+
* amount: parseUnits('1000', 6), // 6 decimals for USDC/AUDD; use token's actual decimals
|
|
21992
22034
|
* kycSignature: { blockExpiration, signature },
|
|
21993
22035
|
* });
|
|
21994
22036
|
* ```
|
|
@@ -22000,11 +22042,11 @@ class DepositsFacade {
|
|
|
22000
22042
|
});
|
|
22001
22043
|
}
|
|
22002
22044
|
/**
|
|
22003
|
-
* Submit a withdrawal request for a specific
|
|
22045
|
+
* Submit a withdrawal request for a specific stable asset amount.
|
|
22004
22046
|
*/
|
|
22005
22047
|
withdraw(params) {
|
|
22006
22048
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22007
|
-
return yield this._userLending.
|
|
22049
|
+
return yield this._userLending.requestWithdrawalInAsset(params.poolId, params.trancheId, params.amount);
|
|
22008
22050
|
});
|
|
22009
22051
|
}
|
|
22010
22052
|
/**
|
|
@@ -8,4 +8,4 @@ import { ChainConfigEntry } from './types';
|
|
|
8
8
|
* const base = CHAIN_CONFIGS.base;
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
|
-
export declare const CHAIN_CONFIGS: Record<'base' | 'xdc' | 'plume', ChainConfigEntry>;
|
|
11
|
+
export declare const CHAIN_CONFIGS: Record<'base' | 'xdc' | 'xdc-usdc' | 'plume', ChainConfigEntry>;
|
|
@@ -58,6 +58,29 @@ export const CHAIN_CONFIGS = {
|
|
|
58
58
|
'0xeda50c91a8c4ca8a83652b8542c0b3bd00a71fad': '0xc347a9e4aec8c8d11a149d2907deb2bf23b81c6f',
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
|
+
'xdc-usdc': {
|
|
62
|
+
chainId: 50,
|
|
63
|
+
name: 'XDC Mainnet (USDC)',
|
|
64
|
+
isLiteDeployment: true,
|
|
65
|
+
contracts: {
|
|
66
|
+
// No KSUToken on Lite deployments
|
|
67
|
+
IKSULocking: '0x47e7C147955FAC86c4AeAe5a8691C1A702A9C4FA',
|
|
68
|
+
IKSULockBonus: '0xe99c77d800E1065f2f1Ab23A6D70cBc7D1102943',
|
|
69
|
+
LendingPoolManager: '0x5ba223175F61221fbc795F71a41f52Bff825C68b',
|
|
70
|
+
UserManager: '0xFd407a09049C4d60a81C708E5587B8C7b6Cf6BdD',
|
|
71
|
+
KasuAllowList: '0xaf911547FD38686a88fc26B2A722F870426bCD6D',
|
|
72
|
+
SystemVariables: '0xb73Ebe67c8597d55A5F4FCc2C1638eDd5512BfBb',
|
|
73
|
+
KsuPrice: '0xA622DE9d439C05266C63EfeA3B7853792aD61f45',
|
|
74
|
+
UserLoyaltyRewards: '0x8e2033DcF9C6D3B9D3B24C651a03c0Af65A113b8',
|
|
75
|
+
ClearingCoordinator: '0x84022117eAD4C22D8A01bC7Fc9743dd101C6a882',
|
|
76
|
+
// No KasuNFTs on Lite deployments
|
|
77
|
+
ExternalTVL: '0xb2367F0B074Ec1788b28283A8af953aaA498d779',
|
|
78
|
+
},
|
|
79
|
+
subgraphUrl: 'https://api.goldsky.com/api/public/project_cmgzlpxm300765np2a19421om/subgraphs/kasu-xdc-usdc/v1.0.0/gn',
|
|
80
|
+
directusUrl: 'https://kasu-finance.directus.app/',
|
|
81
|
+
unusedPoolIds: [],
|
|
82
|
+
poolMetadataMapping: undefined,
|
|
83
|
+
},
|
|
61
84
|
plume: {
|
|
62
85
|
chainId: 98866,
|
|
63
86
|
name: 'Plume Mainnet',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-configs.js","sourceRoot":"","sources":["../../src/facade/chain-configs.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"chain-configs.js","sourceRoot":"","sources":["../../src/facade/chain-configs.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAoE;IAC1F,IAAI,EAAE;QACF,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,cAAc;QACpB,gBAAgB,EAAE,KAAK;QACvB,SAAS,EAAE;YACP,QAAQ,EAAE,4CAA4C;YACtD,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;YAC3D,kBAAkB,EAAE,4CAA4C;YAChE,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;YAC3D,eAAe,EAAE,4CAA4C;YAC7D,QAAQ,EAAE,4CAA4C;YACtD,kBAAkB,EAAE,4CAA4C;YAChE,mBAAmB,EAAE,4CAA4C;YACjE,QAAQ,EAAE,4CAA4C;YACtD,WAAW,EAAE,4CAA4C;SAC5D;QACD,WAAW,EACP,qGAAqG;QACzG,WAAW,EAAE,oCAAoC;QACjD,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,SAAS;KACjC;IAED,GAAG,EAAE;QACD,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,aAAa;QACnB,gBAAgB,EAAE,IAAI;QACtB,SAAS,EAAE;YACP,kCAAkC;YAClC,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;YAC3D,kBAAkB,EAAE,4CAA4C;YAChE,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;YAC3D,eAAe,EAAE,4CAA4C;YAC7D,QAAQ,EAAE,4CAA4C;YACtD,kBAAkB,EAAE,4CAA4C;YAChE,mBAAmB,EAAE,4CAA4C;YACjE,kCAAkC;YAClC,WAAW,EAAE,4CAA4C;SAC5D;QACD,WAAW,EACP,mGAAmG;QACvG,WAAW,EAAE,oCAAoC;QACjD,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE;YACjB,4CAA4C,EACxC,4CAA4C;YAChD,4CAA4C,EACxC,4CAA4C;YAChD,4CAA4C,EACxC,4CAA4C;SACnD;KACJ;IAED,UAAU,EAAE;QACR,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,oBAAoB;QAC1B,gBAAgB,EAAE,IAAI;QACtB,SAAS,EAAE;YACP,kCAAkC;YAClC,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;YAC3D,kBAAkB,EAAE,4CAA4C;YAChE,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;YAC3D,eAAe,EAAE,4CAA4C;YAC7D,QAAQ,EAAE,4CAA4C;YACtD,kBAAkB,EAAE,4CAA4C;YAChE,mBAAmB,EAAE,4CAA4C;YACjE,kCAAkC;YAClC,WAAW,EAAE,4CAA4C;SAC5D;QACD,WAAW,EACP,wGAAwG;QAC5G,WAAW,EAAE,oCAAoC;QACjD,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,SAAS;KACjC;IAED,KAAK,EAAE;QACH,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,eAAe;QACrB,gBAAgB,EAAE,IAAI;QACtB,SAAS,EAAE;YACP,yDAAyD;YACzD,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,EAAE;YACjB,kBAAkB,EAAE,EAAE;YACtB,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,EAAE;YACnB,QAAQ,EAAE,EAAE;YACZ,kBAAkB,EAAE,EAAE;YACtB,mBAAmB,EAAE,EAAE;YACvB,WAAW,EAAE,EAAE;SAClB;QACD,WAAW,EACP,gGAAgG;QACpG,WAAW,EAAE,oCAAoC;QACjD,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,SAAS;KACjC;CACJ,CAAC"}
|
|
@@ -23,14 +23,14 @@ export declare class DepositsFacade {
|
|
|
23
23
|
* const tx = await kasu.deposits.deposit({
|
|
24
24
|
* poolId: '0x...',
|
|
25
25
|
* trancheId: '0x...',
|
|
26
|
-
* amount: parseUnits('1000', 6),
|
|
26
|
+
* amount: parseUnits('1000', 6), // 6 decimals for USDC/AUDD; use token's actual decimals
|
|
27
27
|
* kycSignature: { blockExpiration, signature },
|
|
28
28
|
* });
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
deposit(params: DepositParams): Promise<ContractTransaction>;
|
|
32
32
|
/**
|
|
33
|
-
* Submit a withdrawal request for a specific
|
|
33
|
+
* Submit a withdrawal request for a specific stable asset amount.
|
|
34
34
|
*/
|
|
35
35
|
withdraw(params: WithdrawParams): Promise<ContractTransaction>;
|
|
36
36
|
/**
|
package/dist/facade/deposits.js
CHANGED
|
@@ -30,7 +30,7 @@ export class DepositsFacade {
|
|
|
30
30
|
* const tx = await kasu.deposits.deposit({
|
|
31
31
|
* poolId: '0x...',
|
|
32
32
|
* trancheId: '0x...',
|
|
33
|
-
* amount: parseUnits('1000', 6),
|
|
33
|
+
* amount: parseUnits('1000', 6), // 6 decimals for USDC/AUDD; use token's actual decimals
|
|
34
34
|
* kycSignature: { blockExpiration, signature },
|
|
35
35
|
* });
|
|
36
36
|
* ```
|
|
@@ -42,11 +42,11 @@ export class DepositsFacade {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Submit a withdrawal request for a specific
|
|
45
|
+
* Submit a withdrawal request for a specific stable asset amount.
|
|
46
46
|
*/
|
|
47
47
|
withdraw(params) {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
return yield this._userLending.
|
|
49
|
+
return yield this._userLending.requestWithdrawalInAsset(params.poolId, params.trancheId, params.amount);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposits.js","sourceRoot":"","sources":["../../src/facade/deposits.ts"],"names":[],"mappings":";;;;;;;;;AAMA;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACvB,YACY,YAAyB,EACzB,QAAgB;QADhB,iBAAY,GAAZ,YAAY,CAAa;QACzB,aAAQ,GAAR,QAAQ,CAAQ;IACzB,CAAC;IAEJ;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO,CAAC,MAAqB;;;YAC/B,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAChD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,MAAM,EACb,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI,EACvB,MAAA,MAAM,CAAC,iBAAiB,mCAAI,CAAC,EAC7B,MAAA,MAAM,CAAC,WAAW,mCAAI,IAAI,EAC1B,MAAM,CAAC,YAAY,EACnB,MAAA,MAAM,CAAC,QAAQ,mCAAI,GAAG,CACzB,CAAC;QACN,CAAC;KAAA;IAED;;OAEG;IACG,QAAQ,CAAC,MAAsB;;YACjC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"deposits.js","sourceRoot":"","sources":["../../src/facade/deposits.ts"],"names":[],"mappings":";;;;;;;;;AAMA;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACvB,YACY,YAAyB,EACzB,QAAgB;QADhB,iBAAY,GAAZ,YAAY,CAAa;QACzB,aAAQ,GAAR,QAAQ,CAAQ;IACzB,CAAC;IAEJ;;;;;;;;;;;;;;;;OAgBG;IACG,OAAO,CAAC,MAAqB;;;YAC/B,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAChD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,MAAM,EACb,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI,EACvB,MAAA,MAAM,CAAC,iBAAiB,mCAAI,CAAC,EAC7B,MAAA,MAAM,CAAC,WAAW,mCAAI,IAAI,EAC1B,MAAM,CAAC,YAAY,EACnB,MAAA,MAAM,CAAC,QAAQ,mCAAI,GAAG,CACzB,CAAC;QACN,CAAC;KAAA;IAED;;OAEG;IACG,QAAQ,CAAC,MAAsB;;YACjC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,CACnD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,MAAM,CAChB,CAAC;QACN,CAAC;KAAA;IAED;;OAEG;IACG,WAAW,CACb,MAAc,EACd,SAAiB,EACjB,WAAmB;;YAEnB,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAC/C,MAAM,EACN,SAAS,EACT,WAAW,CACd,CAAC;QACN,CAAC;KAAA;IAED;;;;;OAKG;IACH,cAAc,CAAC,WAA0B;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,uBAAuB,CAC5C,WAAW,EACX,IAAI,CAAC,QAAQ,CAChB,CAAC;IACN,CAAC;IAED;;;OAGG;IACG,iBAAiB,CAAC,MAAc;;YAClC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC7D,CAAC;KAAA;IAED;;OAEG;IACG,eAAe;;YACjB,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;QACrD,CAAC;KAAA;CACJ"}
|
package/dist/facade/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BigNumberish, BytesLike } from 'ethers';
|
|
|
2
2
|
import { ContractAddresses, SdkConfigOptions } from '../sdk-config';
|
|
3
3
|
import { LendingTotals, PoolOverview, TrancheData } from '../services/DataService/types';
|
|
4
4
|
import { PortfolioLendingPool, PortfolioSummary } from '../services/Portfolio/types';
|
|
5
|
-
export type SupportedChain = 'base' | 'xdc' | 'plume';
|
|
5
|
+
export type SupportedChain = 'base' | 'xdc' | 'xdc-usdc' | 'plume';
|
|
6
6
|
export interface ChainConfigEntry {
|
|
7
7
|
chainId: number;
|
|
8
8
|
name: string;
|
|
@@ -57,9 +57,9 @@ export interface StrategyTranche {
|
|
|
57
57
|
apy: number;
|
|
58
58
|
minApy: number;
|
|
59
59
|
maxApy: number;
|
|
60
|
-
/** Minimum deposit in
|
|
60
|
+
/** Minimum deposit in stable asset units (ether-formatted string). */
|
|
61
61
|
minimumDeposit: string;
|
|
62
|
-
/** Maximum deposit in
|
|
62
|
+
/** Maximum deposit in stable asset units (ether-formatted string). */
|
|
63
63
|
maximumDeposit: string;
|
|
64
64
|
/** Remaining tranche capacity (ether-formatted string). */
|
|
65
65
|
availableCapacity: string;
|
|
@@ -78,7 +78,7 @@ export interface FixedTermOption {
|
|
|
78
78
|
export interface DepositParams {
|
|
79
79
|
poolId: string;
|
|
80
80
|
trancheId: string;
|
|
81
|
-
/** Amount in
|
|
81
|
+
/** Amount in stable asset base units (BigNumberish). */
|
|
82
82
|
amount: BigNumberish;
|
|
83
83
|
/** KYC signature obtained from the Nexera flow. */
|
|
84
84
|
kycSignature: {
|
|
@@ -89,7 +89,7 @@ export interface DepositParams {
|
|
|
89
89
|
depositData?: BytesLike;
|
|
90
90
|
/** Fixed-term config ID. Pass `0` for variable deposits. */
|
|
91
91
|
fixedTermConfigId?: BigNumberish;
|
|
92
|
-
/** Swap calldata. Pass `'0x'` when depositing
|
|
92
|
+
/** Swap calldata. Pass `'0x'` when depositing the stable asset directly. */
|
|
93
93
|
swapData?: BytesLike;
|
|
94
94
|
/** Native token value to send (e.g. for gas on some chains). Defaults to `'0'`. */
|
|
95
95
|
ethValue?: string;
|
|
@@ -97,17 +97,17 @@ export interface DepositParams {
|
|
|
97
97
|
export interface WithdrawParams {
|
|
98
98
|
poolId: string;
|
|
99
99
|
trancheId: string;
|
|
100
|
-
/**
|
|
100
|
+
/** Stable asset amount to withdraw, or `'max'` to withdraw entire balance. */
|
|
101
101
|
amount: BigNumberish;
|
|
102
102
|
/** Required when `amount` is `'max'`. */
|
|
103
103
|
userAddress?: string;
|
|
104
104
|
}
|
|
105
105
|
export interface DepositLimits {
|
|
106
|
-
/** Minimum deposit (ether-formatted
|
|
106
|
+
/** Minimum deposit (ether-formatted stable asset amount). */
|
|
107
107
|
min: string;
|
|
108
|
-
/** Maximum deposit (ether-formatted
|
|
108
|
+
/** Maximum deposit (ether-formatted stable asset amount). */
|
|
109
109
|
max: string;
|
|
110
|
-
/** Remaining tranche capacity (ether-formatted
|
|
110
|
+
/** Remaining tranche capacity (ether-formatted stable asset amount). */
|
|
111
111
|
availableCapacity: string;
|
|
112
112
|
}
|
|
113
113
|
export interface KycParams {
|
package/dist/sdk-config.d.ts
CHANGED
|
@@ -33,6 +33,11 @@ export interface SdkConfigOptions {
|
|
|
33
33
|
* Value: pool address in Directus / Base pool (lowercase)
|
|
34
34
|
*/
|
|
35
35
|
poolMetadataMapping?: Record<string, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Decimals of the stable asset used by lending pools (e.g. 6 for USDC/AUDD).
|
|
38
|
+
* @default 6
|
|
39
|
+
*/
|
|
40
|
+
stableAssetDecimals?: number;
|
|
36
41
|
}
|
|
37
42
|
export declare class SdkConfig {
|
|
38
43
|
subgraphUrl: string;
|
|
@@ -42,5 +47,6 @@ export declare class SdkConfig {
|
|
|
42
47
|
UNUSED_LENDING_POOL_IDS: string[];
|
|
43
48
|
isLiteDeployment: boolean;
|
|
44
49
|
poolMetadataMapping: Record<string, string>;
|
|
50
|
+
stableAssetDecimals: number;
|
|
45
51
|
constructor(options: SdkConfigOptions);
|
|
46
52
|
}
|