@defisaver/positions-sdk 0.0.4 → 0.0.6
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/cjs/aaveV2/index.d.ts +2 -2
- package/cjs/aaveV2/index.js +5 -3
- package/cjs/chickenBonds/index.d.ts +4 -0
- package/cjs/chickenBonds/index.js +94 -1
- package/cjs/compoundV3/index.d.ts +2 -2
- package/cjs/compoundV3/index.js +8 -5
- package/cjs/config/contracts.d.ts +180 -2
- package/cjs/config/contracts.js +25 -1
- package/cjs/contracts.d.ts +4 -0
- package/cjs/contracts.js +5 -1
- package/cjs/helpers/chickenBondsHelpers/index.d.ts +2 -0
- package/cjs/helpers/chickenBondsHelpers/index.js +19 -0
- package/cjs/helpers/compoundHelpers/index.d.ts +2 -2
- package/cjs/helpers/compoundHelpers/index.js +5 -4
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/morphoAaveV2/index.d.ts +2 -2
- package/cjs/morphoAaveV2/index.js +5 -3
- package/cjs/services/priceService.d.ts +4 -0
- package/cjs/services/priceService.js +36 -0
- package/cjs/types/chickenBonds.d.ts +41 -0
- package/cjs/types/chickenBonds.js +13 -0
- package/cjs/types/contracts/generated/COMPPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/COMPPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/ChickenBondsManager.d.ts +28 -0
- package/cjs/types/contracts/generated/ChickenBondsManager.js +5 -0
- package/cjs/types/contracts/generated/ChickenBondsView.d.ts +68 -0
- package/cjs/types/contracts/generated/ETHPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/ETHPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/USDCPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/USDCPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +4 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/esm/aaveV2/index.d.ts +2 -2
- package/esm/aaveV2/index.js +5 -3
- package/esm/chickenBonds/index.d.ts +4 -0
- package/esm/chickenBonds/index.js +89 -2
- package/esm/compoundV3/index.d.ts +2 -2
- package/esm/compoundV3/index.js +8 -5
- package/esm/config/contracts.d.ts +180 -2
- package/esm/config/contracts.js +25 -1
- package/esm/contracts.d.ts +4 -0
- package/esm/contracts.js +4 -0
- package/esm/helpers/chickenBondsHelpers/index.d.ts +2 -0
- package/esm/helpers/chickenBondsHelpers/index.js +11 -0
- package/esm/helpers/compoundHelpers/index.d.ts +2 -2
- package/esm/helpers/compoundHelpers/index.js +5 -4
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/morphoAaveV2/index.d.ts +2 -2
- package/esm/morphoAaveV2/index.js +5 -3
- package/esm/services/priceService.d.ts +4 -0
- package/esm/services/priceService.js +27 -0
- package/esm/types/chickenBonds.d.ts +41 -0
- package/esm/types/chickenBonds.js +10 -0
- package/esm/types/contracts/generated/COMPPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/COMPPriceFeed.js +4 -0
- package/esm/types/contracts/generated/ChickenBondsManager.d.ts +28 -0
- package/esm/types/contracts/generated/ChickenBondsManager.js +4 -0
- package/esm/types/contracts/generated/ChickenBondsView.d.ts +68 -0
- package/esm/types/contracts/generated/ETHPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/ETHPriceFeed.js +4 -0
- package/esm/types/contracts/generated/USDCPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/USDCPriceFeed.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +4 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/package.json +1 -1
- package/src/aaveV2/index.ts +5 -3
- package/src/chickenBonds/index.ts +103 -1
- package/src/compoundV3/index.ts +8 -5
- package/src/config/contracts.js +26 -2
- package/src/contracts.ts +7 -1
- package/src/helpers/chickenBondsHelpers/index.ts +13 -0
- package/src/helpers/compoundHelpers/index.ts +5 -2
- package/src/helpers/index.ts +2 -1
- package/src/morphoAaveV2/index.ts +5 -3
- package/src/services/priceService.ts +22 -0
- package/src/types/chickenBonds.ts +45 -0
- package/src/types/contracts/generated/COMPPriceFeed.ts +202 -0
- package/src/types/contracts/generated/ChickenBondsManager.ts +59 -0
- package/src/types/contracts/generated/ChickenBondsView.ts +88 -0
- package/src/types/contracts/generated/ETHPriceFeed.ts +202 -0
- package/src/types/contracts/generated/USDCPriceFeed.ts +202 -0
- package/src/types/contracts/generated/index.ts +4 -0
- package/src/types/index.ts +2 -1
- package/yarn-error.log +0 -64
package/cjs/aaveV2/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
3
|
import { AaveMarketInfo, AaveV2AssetsData, AaveV2PositionData } from '../types';
|
|
4
|
-
export declare const getAaveV2MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: AaveMarketInfo,
|
|
4
|
+
export declare const getAaveV2MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: AaveMarketInfo, mainnetWeb3: Web3) => Promise<{
|
|
5
5
|
assetsData: AaveV2AssetsData;
|
|
6
6
|
}>;
|
|
7
7
|
export declare const getAaveV2AccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
|
|
8
8
|
export declare const getAaveV2AccountData: (web3: Web3, network: NetworkNumber, address: string, assetsData: AaveV2AssetsData, market: AaveMarketInfo) => Promise<AaveV2PositionData>;
|
|
9
|
-
export declare const getAaveV2FullPositionData: (web3: Web3, network: NetworkNumber, address: string, market: AaveMarketInfo,
|
|
9
|
+
export declare const getAaveV2FullPositionData: (web3: Web3, network: NetworkNumber, address: string, market: AaveMarketInfo, mainnetWeb3: Web3) => Promise<AaveV2PositionData>;
|
package/cjs/aaveV2/index.js
CHANGED
|
@@ -22,7 +22,9 @@ const moneymarket_1 = require("../moneymarket");
|
|
|
22
22
|
const aaveV3_1 = require("../aaveV3");
|
|
23
23
|
const aave_1 = require("../markets/aave");
|
|
24
24
|
const aaveHelpers_1 = require("../helpers/aaveHelpers");
|
|
25
|
-
const
|
|
25
|
+
const priceService_1 = require("../services/priceService");
|
|
26
|
+
const getAaveV2MarketsData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const ethPrice = yield (0, priceService_1.getEthPrice)(mainnetWeb3);
|
|
26
28
|
const _addresses = selectedMarket.assets.map(a => (0, tokens_1.getAssetInfo)((0, utils_1.ethToWeth)(a)).address);
|
|
27
29
|
const loanInfoContract = (0, contracts_1.AaveLoanInfoV2Contract)(web3, network);
|
|
28
30
|
const marketAddress = selectedMarket.providerAddress;
|
|
@@ -176,8 +178,8 @@ const getAaveV2AccountData = (web3, network, address, assetsData, market) => __a
|
|
|
176
178
|
return payload;
|
|
177
179
|
});
|
|
178
180
|
exports.getAaveV2AccountData = getAaveV2AccountData;
|
|
179
|
-
const getAaveV2FullPositionData = (web3, network, address, market,
|
|
180
|
-
const marketData = yield (0, exports.getAaveV2MarketsData)(web3, network, market,
|
|
181
|
+
const getAaveV2FullPositionData = (web3, network, address, market, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
182
|
+
const marketData = yield (0, exports.getAaveV2MarketsData)(web3, network, market, mainnetWeb3);
|
|
181
183
|
const positionData = yield (0, exports.getAaveV2AccountData)(web3, network, address, marketData.assetsData, market);
|
|
182
184
|
return positionData;
|
|
183
185
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { Blockish, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
+
import { BondInfoBasic, ChickenBondsSystemInfoBasic } from '../types';
|
|
3
4
|
export declare const getChickenBondsAccountBalances: (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, bondId: string) => Promise<PositionBalances>;
|
|
5
|
+
export declare const fetchCBondsSystemInfo: (web3: Web3, network: NetworkNumber) => Promise<ChickenBondsSystemInfoBasic>;
|
|
6
|
+
export declare const fetchCBondsForUser: (web3: Web3, network: NetworkNumber, address: string) => Promise<BondInfoBasic[]>;
|
|
7
|
+
export declare const fetchCBondForId: (web3: Web3, network: NetworkNumber, bondId: string) => Promise<BondInfoBasic>;
|
|
@@ -8,10 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getChickenBondsAccountBalances = void 0;
|
|
15
|
+
exports.fetchCBondForId = exports.fetchCBondsForUser = exports.fetchCBondsSystemInfo = exports.getChickenBondsAccountBalances = void 0;
|
|
16
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
13
17
|
const tokens_1 = require("@defisaver/tokens");
|
|
14
18
|
const contracts_1 = require("../contracts");
|
|
19
|
+
const multicall_1 = require("../multicall");
|
|
20
|
+
const chickenBondsHelpers_1 = require("../helpers/chickenBondsHelpers");
|
|
15
21
|
const getChickenBondsAccountBalances = (web3, network, block, addressMapping, bondId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
22
|
const viewContract = (0, contracts_1.ChickenBondsViewContract)(web3, network, block);
|
|
17
23
|
const fullBondInfo = yield viewContract.methods.getBondFullInfo(bondId).call({}, block);
|
|
@@ -22,3 +28,90 @@ const getChickenBondsAccountBalances = (web3, network, block, addressMapping, bo
|
|
|
22
28
|
};
|
|
23
29
|
});
|
|
24
30
|
exports.getChickenBondsAccountBalances = getChickenBondsAccountBalances;
|
|
31
|
+
const fetchCBondsSystemInfo = (web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const cBondsView = (0, contracts_1.ChickenBondsViewContract)(web3, network);
|
|
33
|
+
const cBondsManager = (0, contracts_1.ChickenBondsManagerContract)(web3, network);
|
|
34
|
+
const multicallData = [
|
|
35
|
+
{
|
|
36
|
+
target: cBondsView.options.address,
|
|
37
|
+
abiItem: cBondsView.options.jsonInterface.find(({ name }) => name === 'getSystemInfo'),
|
|
38
|
+
params: [],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
target: cBondsManager.options.address,
|
|
42
|
+
abiItem: cBondsManager.options.jsonInterface.find(({ name }) => name === 'totalWeightedStartTimes'),
|
|
43
|
+
params: [],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
target: cBondsManager.options.address,
|
|
47
|
+
abiItem: cBondsManager.options.jsonInterface.find(({ name }) => name === 'getAcquiredLUSDInSP'),
|
|
48
|
+
params: [],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
target: cBondsManager.options.address,
|
|
52
|
+
abiItem: cBondsManager.options.jsonInterface.find(({ name }) => name === 'getAcquiredLUSDInCurve'),
|
|
53
|
+
params: [],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
target: cBondsManager.options.address,
|
|
57
|
+
abiItem: cBondsManager.options.jsonInterface.find(({ name }) => name === 'yTokensHeldByCBM'),
|
|
58
|
+
params: [],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
const [{ 0: systemInfo }, { 0: totalWeightedStartTimes }, { 0: acquiredLUSDInSP }, { 0: acquiredLUSDInCurve }, { 0: yTokensHeldByCBM }] = yield (0, multicall_1.multicall)(multicallData, web3, network);
|
|
62
|
+
const payload = {
|
|
63
|
+
numPendingBonds: systemInfo.numPendingBonds,
|
|
64
|
+
numChickenInBonds: systemInfo.numChickenInBonds,
|
|
65
|
+
numChickenOutBonds: systemInfo.numChickenOutBonds,
|
|
66
|
+
accrualParameter: new decimal_js_1.default((0, tokens_1.assetAmountInEth)(systemInfo.accrualParameter)).mul(1000).toString(),
|
|
67
|
+
bLUSDSupply: (0, tokens_1.assetAmountInEth)(systemInfo.bLUSDSupply, 'bLUSD'),
|
|
68
|
+
chickenInAMMFee: (0, tokens_1.assetAmountInEth)(systemInfo.chickenInAMMFee),
|
|
69
|
+
ownedLUSDInCurve: (0, tokens_1.assetAmountInEth)(systemInfo.ownedLUSDInCurve, 'LUSD'),
|
|
70
|
+
systemBackingRatio: (0, tokens_1.assetAmountInEth)(systemInfo.systemBackingRatio),
|
|
71
|
+
ownedLUSDInSP: (0, tokens_1.assetAmountInEth)(systemInfo.ownedLUSDInSP, 'LUSD'),
|
|
72
|
+
totalPendingLUSD: (0, tokens_1.assetAmountInEth)(systemInfo.totalPendingLUSD, 'LUSD'),
|
|
73
|
+
totalPermanentLUSD: (0, tokens_1.assetAmountInEth)(systemInfo.totalPermanentLUSD, 'LUSD'),
|
|
74
|
+
totalReserveLUSD: (0, tokens_1.assetAmountInEth)(systemInfo.totalReserveLUSD, 'LUSD'),
|
|
75
|
+
targetAverageAgeMs: 1296000000,
|
|
76
|
+
totalWeightedStartTimes: (0, tokens_1.assetAmountInEth)(totalWeightedStartTimes),
|
|
77
|
+
acquiredLUSDInSP: (0, tokens_1.assetAmountInEth)(acquiredLUSDInSP, 'LUSD'),
|
|
78
|
+
acquiredLUSDInCurve: (0, tokens_1.assetAmountInEth)(acquiredLUSDInCurve, 'LUSD'),
|
|
79
|
+
yTokensHeldByCBM: (0, tokens_1.assetAmountInEth)(yTokensHeldByCBM, 'ETH'), // yTokens is 18 decimals
|
|
80
|
+
};
|
|
81
|
+
const floorPrice = (0, chickenBondsHelpers_1.calcCBondsBLUSDFloorPrice)(payload.bLUSDSupply, payload.totalReserveLUSD);
|
|
82
|
+
const averageBondAgeMs = (0, chickenBondsHelpers_1.calcAverageBondAgeMs)(payload.totalWeightedStartTimes, payload.totalPendingLUSD);
|
|
83
|
+
return Object.assign(Object.assign({}, payload), { floorPrice,
|
|
84
|
+
averageBondAgeMs });
|
|
85
|
+
});
|
|
86
|
+
exports.fetchCBondsSystemInfo = fetchCBondsSystemInfo;
|
|
87
|
+
const fetchCBondsForUser = (web3, network, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
+
const cBondsView = (0, contracts_1.ChickenBondsViewContract)(web3, network);
|
|
89
|
+
const bonds = yield cBondsView.methods.getUsersBonds(address).call();
|
|
90
|
+
return bonds.map(({ bondID, accruedBLUSD, claimedBLUSD, endTime, lusdAmount, maxAmountBLUSD, startTime, status, tokenURI, }) => ({
|
|
91
|
+
bondId: bondID,
|
|
92
|
+
status,
|
|
93
|
+
// tokenURI: decodeTokenURIToSvg(tokenURI),
|
|
94
|
+
startTime: new Date(+startTime * 1000),
|
|
95
|
+
endTime: new Date(+endTime * 1000),
|
|
96
|
+
accruedBLUSD: (0, tokens_1.assetAmountInEth)(accruedBLUSD, 'bLUSD'),
|
|
97
|
+
claimedBLUSD: (0, tokens_1.assetAmountInEth)(claimedBLUSD, 'bLUSD'),
|
|
98
|
+
lusdAmount: (0, tokens_1.assetAmountInEth)(lusdAmount, 'LUSD'),
|
|
99
|
+
maxAmountBLUSD: (0, tokens_1.assetAmountInEth)(maxAmountBLUSD, 'bLUSD'),
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
exports.fetchCBondsForUser = fetchCBondsForUser;
|
|
103
|
+
const fetchCBondForId = (web3, network, bondId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
+
const cBondsView = (0, contracts_1.ChickenBondsViewContract)(web3, network);
|
|
105
|
+
const bond = yield cBondsView.methods.getBondFullInfo(bondId).call();
|
|
106
|
+
return {
|
|
107
|
+
bondId,
|
|
108
|
+
status: bond.status,
|
|
109
|
+
startTime: new Date(+bond.startTime * 1000),
|
|
110
|
+
endTime: new Date(+bond.endTime * 1000),
|
|
111
|
+
accruedBLUSD: (0, tokens_1.assetAmountInEth)(bond.accruedBLUSD, 'bLUSD'),
|
|
112
|
+
claimedBLUSD: (0, tokens_1.assetAmountInEth)(bond.claimedBLUSD, 'bLUSD'),
|
|
113
|
+
lusdAmount: (0, tokens_1.assetAmountInEth)(bond.lusdAmount, 'LUSD'),
|
|
114
|
+
maxAmountBLUSD: (0, tokens_1.assetAmountInEth)(bond.maxAmountBLUSD, 'bLUSD'),
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
exports.fetchCBondForId = fetchCBondForId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { CompoundMarketData, CompoundV3AssetsData, CompoundV3MarketsData, CompoundV3PositionData } from '../types/compound';
|
|
3
3
|
import { Blockish, EthAddress, NetworkNumber, PositionBalances } from '../types/common';
|
|
4
|
-
export declare const getCompoundV3MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: CompoundMarketData,
|
|
4
|
+
export declare const getCompoundV3MarketsData: (web3: Web3, network: NetworkNumber, selectedMarket: CompoundMarketData, defaultWeb3: Web3) => Promise<CompoundV3MarketsData>;
|
|
5
5
|
export declare const EMPTY_COMPOUND_V3_DATA: {
|
|
6
6
|
usedAssets: {};
|
|
7
7
|
suppliedUsd: string;
|
|
@@ -34,4 +34,4 @@ export declare const getCompoundV3AccountData: (web3: Web3, network: NetworkNumb
|
|
|
34
34
|
selectedMarket: CompoundMarketData;
|
|
35
35
|
assetsData: CompoundV3AssetsData;
|
|
36
36
|
})) => Promise<CompoundV3PositionData>;
|
|
37
|
-
export declare const getCompoundV3FullPositionData: (web3: Web3, network: NetworkNumber, address: string, proxyAddress: string, selectedMarket: CompoundMarketData,
|
|
37
|
+
export declare const getCompoundV3FullPositionData: (web3: Web3, network: NetworkNumber, address: string, proxyAddress: string, selectedMarket: CompoundMarketData, mainnetWeb3: Web3) => Promise<CompoundV3PositionData>;
|
package/cjs/compoundV3/index.js
CHANGED
|
@@ -24,7 +24,10 @@ const constants_1 = require("../constants");
|
|
|
24
24
|
const moneymarket_1 = require("../moneymarket");
|
|
25
25
|
const compoundHelpers_1 = require("../helpers/compoundHelpers");
|
|
26
26
|
const compound_2 = require("../markets/compound");
|
|
27
|
-
const
|
|
27
|
+
const priceService_1 = require("../services/priceService");
|
|
28
|
+
const getCompoundV3MarketsData = (web3, network, selectedMarket, defaultWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const baseAssetPrice = selectedMarket.baseAsset === 'ETH' ? yield (0, priceService_1.getEthPrice)(defaultWeb3) : yield (0, priceService_1.getUSDCPrice)(defaultWeb3);
|
|
30
|
+
const compPrice = yield (0, priceService_1.getCompPrice)(defaultWeb3);
|
|
28
31
|
const contract = (0, contracts_1.CompV3ViewContract)(web3, network);
|
|
29
32
|
const CompV3ViewAddress = contract.options.address;
|
|
30
33
|
const calls = [
|
|
@@ -40,7 +43,7 @@ const getCompoundV3MarketsData = (web3, network, selectedMarket, compPrice, defa
|
|
|
40
43
|
},
|
|
41
44
|
];
|
|
42
45
|
const data = yield (0, multicall_1.multicall)(calls, web3, network);
|
|
43
|
-
const colls = data[1].colls.map((coll) => (0, compoundHelpers_1.formatMarketData)(coll, network));
|
|
46
|
+
const colls = data[1].colls.map((coll) => (0, compoundHelpers_1.formatMarketData)(coll, network, baseAssetPrice));
|
|
44
47
|
if (selectedMarket.value === compound_1.CompoundVersions.CompoundV3ETH) {
|
|
45
48
|
for (const coll of colls) {
|
|
46
49
|
if (coll.symbol === 'wstETH') {
|
|
@@ -67,7 +70,7 @@ const getCompoundV3MarketsData = (web3, network, selectedMarket, compPrice, defa
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
const base = (0, compoundHelpers_1.formatBaseData)(data[0].baseToken, network);
|
|
73
|
+
const base = (0, compoundHelpers_1.formatBaseData)(data[0].baseToken, network, baseAssetPrice);
|
|
71
74
|
const payload = {};
|
|
72
75
|
const baseObj = Object.assign(Object.assign({}, base), (0, compoundHelpers_1.getIncentiveApys)(base, compPrice));
|
|
73
76
|
const allAssets = [baseObj, ...colls];
|
|
@@ -200,8 +203,8 @@ const getCompoundV3AccountData = (web3, network, address, proxyAddress, extracte
|
|
|
200
203
|
return payload;
|
|
201
204
|
});
|
|
202
205
|
exports.getCompoundV3AccountData = getCompoundV3AccountData;
|
|
203
|
-
const getCompoundV3FullPositionData = (web3, network, address, proxyAddress, selectedMarket,
|
|
204
|
-
const marketData = yield (0, exports.getCompoundV3MarketsData)(web3, network, selectedMarket,
|
|
206
|
+
const getCompoundV3FullPositionData = (web3, network, address, proxyAddress, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
207
|
+
const marketData = yield (0, exports.getCompoundV3MarketsData)(web3, network, selectedMarket, mainnetWeb3);
|
|
205
208
|
const positionData = yield (0, exports.getCompoundV3AccountData)(web3, network, address, proxyAddress, { selectedMarket, assetsData: marketData.assetsData });
|
|
206
209
|
return positionData;
|
|
207
210
|
});
|
|
@@ -2997,7 +2997,17 @@ export namespace McdDog {
|
|
|
2997
2997
|
export { networks_55 as networks };
|
|
2998
2998
|
}
|
|
2999
2999
|
export namespace ChickenBondsView {
|
|
3000
|
-
let abi_56: {
|
|
3000
|
+
let abi_56: ({
|
|
3001
|
+
inputs: never[];
|
|
3002
|
+
name: string;
|
|
3003
|
+
outputs: {
|
|
3004
|
+
internalType: string;
|
|
3005
|
+
name: string;
|
|
3006
|
+
type: string;
|
|
3007
|
+
}[];
|
|
3008
|
+
stateMutability: string;
|
|
3009
|
+
type: string;
|
|
3010
|
+
} | {
|
|
3001
3011
|
inputs: {
|
|
3002
3012
|
internalType: string;
|
|
3003
3013
|
name: string;
|
|
@@ -3016,7 +3026,7 @@ export namespace ChickenBondsView {
|
|
|
3016
3026
|
}[];
|
|
3017
3027
|
stateMutability: string;
|
|
3018
3028
|
type: string;
|
|
3019
|
-
}[];
|
|
3029
|
+
})[];
|
|
3020
3030
|
export { abi_56 as abi };
|
|
3021
3031
|
let networks_56: {
|
|
3022
3032
|
"1": {
|
|
@@ -3026,3 +3036,171 @@ export namespace ChickenBondsView {
|
|
|
3026
3036
|
};
|
|
3027
3037
|
export { networks_56 as networks };
|
|
3028
3038
|
}
|
|
3039
|
+
export namespace ChickenBondsManager {
|
|
3040
|
+
let abi_57: {
|
|
3041
|
+
inputs: {
|
|
3042
|
+
internalType: string;
|
|
3043
|
+
name: string;
|
|
3044
|
+
type: string;
|
|
3045
|
+
}[];
|
|
3046
|
+
name: string;
|
|
3047
|
+
outputs: {
|
|
3048
|
+
internalType: string;
|
|
3049
|
+
name: string;
|
|
3050
|
+
type: string;
|
|
3051
|
+
}[];
|
|
3052
|
+
stateMutability: string;
|
|
3053
|
+
type: string;
|
|
3054
|
+
}[];
|
|
3055
|
+
export { abi_57 as abi };
|
|
3056
|
+
let networks_57: {
|
|
3057
|
+
"1": {
|
|
3058
|
+
address: string;
|
|
3059
|
+
};
|
|
3060
|
+
};
|
|
3061
|
+
export { networks_57 as networks };
|
|
3062
|
+
}
|
|
3063
|
+
export namespace COMPPriceFeed {
|
|
3064
|
+
let abi_58: ({
|
|
3065
|
+
inputs: {
|
|
3066
|
+
internalType: string;
|
|
3067
|
+
name: string;
|
|
3068
|
+
type: string;
|
|
3069
|
+
}[];
|
|
3070
|
+
stateMutability: string;
|
|
3071
|
+
type: string;
|
|
3072
|
+
anonymous?: undefined;
|
|
3073
|
+
name?: undefined;
|
|
3074
|
+
outputs?: undefined;
|
|
3075
|
+
} | {
|
|
3076
|
+
anonymous: boolean;
|
|
3077
|
+
inputs: {
|
|
3078
|
+
indexed: boolean;
|
|
3079
|
+
internalType: string;
|
|
3080
|
+
name: string;
|
|
3081
|
+
type: string;
|
|
3082
|
+
}[];
|
|
3083
|
+
name: string;
|
|
3084
|
+
type: string;
|
|
3085
|
+
stateMutability?: undefined;
|
|
3086
|
+
outputs?: undefined;
|
|
3087
|
+
} | {
|
|
3088
|
+
inputs: {
|
|
3089
|
+
internalType: string;
|
|
3090
|
+
name: string;
|
|
3091
|
+
type: string;
|
|
3092
|
+
}[];
|
|
3093
|
+
name: string;
|
|
3094
|
+
outputs: {
|
|
3095
|
+
internalType: string;
|
|
3096
|
+
name: string;
|
|
3097
|
+
type: string;
|
|
3098
|
+
}[];
|
|
3099
|
+
stateMutability: string;
|
|
3100
|
+
type: string;
|
|
3101
|
+
anonymous?: undefined;
|
|
3102
|
+
})[];
|
|
3103
|
+
export { abi_58 as abi };
|
|
3104
|
+
let networks_58: {
|
|
3105
|
+
"1": {
|
|
3106
|
+
address: string;
|
|
3107
|
+
};
|
|
3108
|
+
};
|
|
3109
|
+
export { networks_58 as networks };
|
|
3110
|
+
}
|
|
3111
|
+
export namespace ETHPriceFeed {
|
|
3112
|
+
let abi_59: ({
|
|
3113
|
+
inputs: {
|
|
3114
|
+
internalType: string;
|
|
3115
|
+
name: string;
|
|
3116
|
+
type: string;
|
|
3117
|
+
}[];
|
|
3118
|
+
stateMutability: string;
|
|
3119
|
+
type: string;
|
|
3120
|
+
anonymous?: undefined;
|
|
3121
|
+
name?: undefined;
|
|
3122
|
+
outputs?: undefined;
|
|
3123
|
+
} | {
|
|
3124
|
+
anonymous: boolean;
|
|
3125
|
+
inputs: {
|
|
3126
|
+
indexed: boolean;
|
|
3127
|
+
internalType: string;
|
|
3128
|
+
name: string;
|
|
3129
|
+
type: string;
|
|
3130
|
+
}[];
|
|
3131
|
+
name: string;
|
|
3132
|
+
type: string;
|
|
3133
|
+
stateMutability?: undefined;
|
|
3134
|
+
outputs?: undefined;
|
|
3135
|
+
} | {
|
|
3136
|
+
inputs: {
|
|
3137
|
+
internalType: string;
|
|
3138
|
+
name: string;
|
|
3139
|
+
type: string;
|
|
3140
|
+
}[];
|
|
3141
|
+
name: string;
|
|
3142
|
+
outputs: {
|
|
3143
|
+
internalType: string;
|
|
3144
|
+
name: string;
|
|
3145
|
+
type: string;
|
|
3146
|
+
}[];
|
|
3147
|
+
stateMutability: string;
|
|
3148
|
+
type: string;
|
|
3149
|
+
anonymous?: undefined;
|
|
3150
|
+
})[];
|
|
3151
|
+
export { abi_59 as abi };
|
|
3152
|
+
let networks_59: {
|
|
3153
|
+
"1": {
|
|
3154
|
+
address: string;
|
|
3155
|
+
};
|
|
3156
|
+
};
|
|
3157
|
+
export { networks_59 as networks };
|
|
3158
|
+
}
|
|
3159
|
+
export namespace USDCPriceFeed {
|
|
3160
|
+
let abi_60: ({
|
|
3161
|
+
inputs: {
|
|
3162
|
+
internalType: string;
|
|
3163
|
+
name: string;
|
|
3164
|
+
type: string;
|
|
3165
|
+
}[];
|
|
3166
|
+
stateMutability: string;
|
|
3167
|
+
type: string;
|
|
3168
|
+
anonymous?: undefined;
|
|
3169
|
+
name?: undefined;
|
|
3170
|
+
outputs?: undefined;
|
|
3171
|
+
} | {
|
|
3172
|
+
anonymous: boolean;
|
|
3173
|
+
inputs: {
|
|
3174
|
+
indexed: boolean;
|
|
3175
|
+
internalType: string;
|
|
3176
|
+
name: string;
|
|
3177
|
+
type: string;
|
|
3178
|
+
}[];
|
|
3179
|
+
name: string;
|
|
3180
|
+
type: string;
|
|
3181
|
+
stateMutability?: undefined;
|
|
3182
|
+
outputs?: undefined;
|
|
3183
|
+
} | {
|
|
3184
|
+
inputs: {
|
|
3185
|
+
internalType: string;
|
|
3186
|
+
name: string;
|
|
3187
|
+
type: string;
|
|
3188
|
+
}[];
|
|
3189
|
+
name: string;
|
|
3190
|
+
outputs: {
|
|
3191
|
+
internalType: string;
|
|
3192
|
+
name: string;
|
|
3193
|
+
type: string;
|
|
3194
|
+
}[];
|
|
3195
|
+
stateMutability: string;
|
|
3196
|
+
type: string;
|
|
3197
|
+
anonymous?: undefined;
|
|
3198
|
+
})[];
|
|
3199
|
+
export { abi_60 as abi };
|
|
3200
|
+
let networks_60: {
|
|
3201
|
+
"1": {
|
|
3202
|
+
address: string;
|
|
3203
|
+
};
|
|
3204
|
+
};
|
|
3205
|
+
export { networks_60 as networks };
|
|
3206
|
+
}
|
package/cjs/config/contracts.js
CHANGED
|
@@ -585,12 +585,36 @@ module.exports = {
|
|
|
585
585
|
}
|
|
586
586
|
},
|
|
587
587
|
"ChickenBondsView": {
|
|
588
|
-
"abi": [{ "inputs": [{ "internalType": "uint256", "name": "_bondID", "type": "uint256" }], "name": "getBondFullInfo", "outputs": [{ "components": [{ "internalType": "uint256", "name": "bondID", "type": "uint256" }, { "internalType": "uint256", "name": "lusdAmount", "type": "uint256" }, { "internalType": "uint64", "name": "claimedBLUSD", "type": "uint64" }, { "internalType": "uint256", "name": "accruedBLUSD", "type": "uint256" }, { "internalType": "uint256", "name": "maxAmountBLUSD", "type": "uint256" }, { "internalType": "uint64", "name": "startTime", "type": "uint64" }, { "internalType": "uint64", "name": "endTime", "type": "uint64" }, { "internalType": "enum IChickenBondManager.BondStatus", "name": "status", "type": "uint8" }, { "internalType": "string", "name": "tokenURI", "type": "string" }], "internalType": "struct ChickenBondsView.BondDataFull", "name": "bond", "type": "tuple" }], "stateMutability": "view", "type": "function" }],
|
|
588
|
+
"abi": [{ "inputs": [], "name": "BorrowerOperations", "outputs": [{ "internalType": "contract IBorrowerOperations", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "CBManager", "outputs": [{ "internalType": "contract IChickenBondManager", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "CollSurplusPool", "outputs": [{ "internalType": "contract ICollSurplusPool", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "HintHelpers", "outputs": [{ "internalType": "contract IHintHelpers", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "LQTYStaking", "outputs": [{ "internalType": "contract ILQTYStaking", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "LUSD_GAS_COMPENSATION", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "PriceFeed", "outputs": [{ "internalType": "contract IPriceFeed", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SortedTroves", "outputs": [{ "internalType": "contract ISortedTroves", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "StabilityPool", "outputs": [{ "internalType": "contract IStabilityPool", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "TroveManager", "outputs": [{ "internalType": "contract ITroveManager", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_bondID", "type": "uint256" }], "name": "getBondFullInfo", "outputs": [{ "components": [{ "internalType": "uint256", "name": "bondID", "type": "uint256" }, { "internalType": "uint256", "name": "lusdAmount", "type": "uint256" }, { "internalType": "uint64", "name": "claimedBLUSD", "type": "uint64" }, { "internalType": "uint256", "name": "accruedBLUSD", "type": "uint256" }, { "internalType": "uint256", "name": "maxAmountBLUSD", "type": "uint256" }, { "internalType": "uint64", "name": "startTime", "type": "uint64" }, { "internalType": "uint64", "name": "endTime", "type": "uint64" }, { "internalType": "enum IChickenBondManager.BondStatus", "name": "status", "type": "uint8" }, { "internalType": "string", "name": "tokenURI", "type": "string" }], "internalType": "struct ChickenBondsView.BondDataFull", "name": "bond", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getSystemInfo", "outputs": [{ "components": [{ "internalType": "uint256", "name": "totalPendingLUSD", "type": "uint256" }, { "internalType": "uint256", "name": "totalReserveLUSD", "type": "uint256" }, { "internalType": "uint256", "name": "totalPermanentLUSD", "type": "uint256" }, { "internalType": "uint256", "name": "ownedLUSDInSP", "type": "uint256" }, { "internalType": "uint256", "name": "ownedLUSDInCurve", "type": "uint256" }, { "internalType": "uint256", "name": "systemBackingRatio", "type": "uint256" }, { "internalType": "uint256", "name": "accrualParameter", "type": "uint256" }, { "internalType": "uint256", "name": "chickenInAMMFee", "type": "uint256" }, { "internalType": "uint256", "name": "numPendingBonds", "type": "uint256" }, { "internalType": "uint256", "name": "numChickenInBonds", "type": "uint256" }, { "internalType": "uint256", "name": "numChickenOutBonds", "type": "uint256" }, { "internalType": "uint256", "name": "bLUSDSupply", "type": "uint256" }], "internalType": "struct ChickenBondsView.ChickenBondsSystemInfo", "name": "systemInfo", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_userAddr", "type": "address" }], "name": "getUsersBonds", "outputs": [{ "components": [{ "internalType": "uint256", "name": "bondID", "type": "uint256" }, { "internalType": "uint256", "name": "lusdAmount", "type": "uint256" }, { "internalType": "uint64", "name": "claimedBLUSD", "type": "uint64" }, { "internalType": "uint256", "name": "accruedBLUSD", "type": "uint256" }, { "internalType": "uint256", "name": "maxAmountBLUSD", "type": "uint256" }, { "internalType": "uint64", "name": "startTime", "type": "uint64" }, { "internalType": "uint64", "name": "endTime", "type": "uint64" }, { "internalType": "enum IChickenBondManager.BondStatus", "name": "status", "type": "uint8" }, { "internalType": "string", "name": "tokenURI", "type": "string" }], "internalType": "struct ChickenBondsView.BondDataFull[]", "name": "bonds", "type": "tuple[]" }], "stateMutability": "view", "type": "function" }],
|
|
589
589
|
"networks": {
|
|
590
590
|
"1": {
|
|
591
591
|
"address": "0x809a93fd4a0d7d7906Ef6176f0b5518b418Da08f",
|
|
592
592
|
"createdBlock": 15739450
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
+
},
|
|
596
|
+
"ChickenBondsManager": {
|
|
597
|
+
"abi": [{ "inputs": [{ "internalType": "uint256", "name": "_bondID", "type": "uint256" }], "name": "chickenIn", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_bondID", "type": "uint256" }, { "internalType": "uint256", "name": "_minLUSD", "type": "uint256" }], "name": "chickenOut", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_lusdAmount", "type": "uint256" }], "name": "createBond", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "getAcquiredLUSDInCurve", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getAcquiredLUSDInSP", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_bLUSDToRedeem", "type": "uint256" }, { "internalType": "uint256", "name": "_minLUSDFromBAMMSPVault", "type": "uint256" }], "name": "redeem", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "totalWeightedStartTimes", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "yTokensHeldByCBM", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
598
|
+
"networks": {
|
|
599
|
+
"1": { "address": "0x57619FE9C539f890b19c61812226F9703ce37137" }
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
"COMPPriceFeed": {
|
|
603
|
+
"abi": [{ "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }, { "internalType": "address", "name": "_accessController", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "int256", "name": "current", "type": "int256" }, { "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" }], "name": "AnswerUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" }], "name": "NewRound", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "accessController", "outputs": [{ "internalType": "contract AccessControllerInterface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "aggregator", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "confirmAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "description", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "getRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRound", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "name": "phaseAggregators", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "phaseId", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "proposeAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proposedAggregator", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "proposedGetRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proposedLatestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_accessController", "type": "address" }], "name": "setController", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_to", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "version", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
604
|
+
"networks": {
|
|
605
|
+
"1": { "address": "0xdbd020CAeF83eFd542f4De03e3cF0C28A4428bd5" }
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
"ETHPriceFeed": {
|
|
609
|
+
"abi": [{ "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }, { "internalType": "address", "name": "_accessController", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "int256", "name": "current", "type": "int256" }, { "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" }], "name": "AnswerUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" }], "name": "NewRound", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "accessController", "outputs": [{ "internalType": "contract AccessControllerInterface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "aggregator", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "confirmAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "description", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "getRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRound", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address payable", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "name": "phaseAggregators", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "phaseId", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "proposeAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proposedAggregator", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "proposedGetRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proposedLatestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_accessController", "type": "address" }], "name": "setController", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_to", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "version", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
610
|
+
"networks": {
|
|
611
|
+
"1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" }
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
"USDCPriceFeed": {
|
|
615
|
+
"abi": [{ "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }, { "internalType": "address", "name": "_accessController", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "int256", "name": "current", "type": "int256" }, { "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "updatedAt", "type": "uint256" }], "name": "AnswerUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "roundId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "startedBy", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "startedAt", "type": "uint256" }], "name": "NewRound", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "accessController", "outputs": [{ "internalType": "contract AccessControllerInterface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "aggregator", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "confirmAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "description", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "getRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_roundId", "type": "uint256" }], "name": "getTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestAnswer", "outputs": [{ "internalType": "int256", "name": "", "type": "int256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRound", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "latestTimestamp", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "name": "phaseAggregators", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "phaseId", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_aggregator", "type": "address" }], "name": "proposeAggregator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proposedAggregator", "outputs": [{ "internalType": "contract AggregatorV2V3Interface", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint80", "name": "_roundId", "type": "uint80" }], "name": "proposedGetRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proposedLatestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_accessController", "type": "address" }], "name": "setController", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_to", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "version", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
616
|
+
"networks": {
|
|
617
|
+
"1": { "address": "0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6" }
|
|
618
|
+
}
|
|
595
619
|
}
|
|
596
620
|
};
|
package/cjs/contracts.d.ts
CHANGED
|
@@ -38,3 +38,7 @@ export declare const McdDogContract: (web3: Web3, network: NetworkNumber, block?
|
|
|
38
38
|
export declare const McdJugContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.McdJug;
|
|
39
39
|
export declare const McdVatContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.McdVat;
|
|
40
40
|
export declare const ChickenBondsViewContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.ChickenBondsView;
|
|
41
|
+
export declare const ChickenBondsManagerContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.ChickenBondsManager;
|
|
42
|
+
export declare const ETHPriceFeedContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.ETHPriceFeed;
|
|
43
|
+
export declare const COMPPriceFeedContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.COMPPriceFeed;
|
|
44
|
+
export declare const USDCPriceFeedContract: (web3: Web3, network: NetworkNumber, block?: Blockish) => ContractTypes.USDCPriceFeed;
|
package/cjs/contracts.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ChickenBondsViewContract = exports.McdVatContract = exports.McdJugContract = exports.McdDogContract = exports.McdSpotterContract = exports.McdViewContract = exports.LiquityActivePoolContract = exports.LiquityPriceFeedContract = exports.LiquityTroveManagerContract = exports.LiquityCollSurplusPoolContract = exports.LiquityViewContract = exports.CrvUSDFactoryContract = exports.CrvUSDViewContract = exports.SparkViewContract = exports.SparkIncentiveDataProviderContract = exports.MorphoAaveV2ViewContract = exports.PotContract = exports.ComptrollerContract = exports.CompoundLoanInfoContract = exports.AaveLoanInfoV2Contract = exports.wstETHContract = exports.CompV3ViewContract = exports.BalanceScannerContract = exports.REthContract = exports.CbEthContract = exports.LidoContract = exports.GhoTokenContract = exports.AaveIncentiveDataProviderV3Contract = exports.AaveV3ViewContract = exports.UniMulticallContract = exports.createContractWrapper = exports.getErc20Contract = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
6
|
+
exports.USDCPriceFeedContract = exports.COMPPriceFeedContract = exports.ETHPriceFeedContract = exports.ChickenBondsManagerContract = exports.ChickenBondsViewContract = exports.McdVatContract = exports.McdJugContract = exports.McdDogContract = exports.McdSpotterContract = exports.McdViewContract = exports.LiquityActivePoolContract = exports.LiquityPriceFeedContract = exports.LiquityTroveManagerContract = exports.LiquityCollSurplusPoolContract = exports.LiquityViewContract = exports.CrvUSDFactoryContract = exports.CrvUSDViewContract = exports.SparkViewContract = exports.SparkIncentiveDataProviderContract = exports.MorphoAaveV2ViewContract = exports.PotContract = exports.ComptrollerContract = exports.CompoundLoanInfoContract = exports.AaveLoanInfoV2Contract = exports.wstETHContract = exports.CompV3ViewContract = exports.BalanceScannerContract = exports.REthContract = exports.CbEthContract = exports.LidoContract = exports.GhoTokenContract = exports.AaveIncentiveDataProviderV3Contract = exports.AaveV3ViewContract = exports.UniMulticallContract = exports.createContractWrapper = exports.getErc20Contract = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
7
7
|
const contracts_1 = __importDefault(require("./config/contracts"));
|
|
8
8
|
const contractConfig = contracts_1.default;
|
|
9
9
|
const getConfigContractAddress = (name, network, block) => {
|
|
@@ -63,3 +63,7 @@ exports.McdDogContract = createContractFromConfigFunc('McdDog');
|
|
|
63
63
|
exports.McdJugContract = createContractFromConfigFunc('McdJug');
|
|
64
64
|
exports.McdVatContract = createContractFromConfigFunc('McdVat');
|
|
65
65
|
exports.ChickenBondsViewContract = createContractFromConfigFunc('ChickenBondsView');
|
|
66
|
+
exports.ChickenBondsManagerContract = createContractFromConfigFunc('ChickenBondsManager');
|
|
67
|
+
exports.ETHPriceFeedContract = createContractFromConfigFunc('ETHPriceFeed');
|
|
68
|
+
exports.COMPPriceFeedContract = createContractFromConfigFunc('COMPPriceFeed');
|
|
69
|
+
exports.USDCPriceFeedContract = createContractFromConfigFunc('USDCPriceFeed');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.calcAverageBondAgeMs = exports.calcCBondsBLUSDFloorPrice = void 0;
|
|
7
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
|
+
const calcCBondsBLUSDFloorPrice = (bLUSDSupply, totalReserveLUSD) => {
|
|
9
|
+
if (new decimal_js_1.default(bLUSDSupply).eq(0))
|
|
10
|
+
return '1';
|
|
11
|
+
return new decimal_js_1.default(totalReserveLUSD).div(bLUSDSupply).toString();
|
|
12
|
+
};
|
|
13
|
+
exports.calcCBondsBLUSDFloorPrice = calcCBondsBLUSDFloorPrice;
|
|
14
|
+
const calcAverageBondAgeMs = (totalWeightedStartTimes, totalPendingLusd) => {
|
|
15
|
+
const averageStartTimeMs = new decimal_js_1.default(totalWeightedStartTimes).div(totalPendingLusd).round().mul(1000)
|
|
16
|
+
.toNumber();
|
|
17
|
+
return Date.now() - averageStartTimeMs;
|
|
18
|
+
};
|
|
19
|
+
exports.calcAverageBondAgeMs = calcAverageBondAgeMs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseAdditionalAssetData, CompoundAggregatedPositionData, CompoundMarketData, CompoundV2AssetsData, CompoundV2UsedAssets, CompoundV3AssetData, CompoundV3AssetsData, CompoundV3UsedAssets } from '../../types';
|
|
2
2
|
import { NetworkNumber } from '../../types/common';
|
|
3
|
-
export declare const formatMarketData: (data: any, network: NetworkNumber) => CompoundV3AssetData;
|
|
4
|
-
export declare const formatBaseData: (data: any, network: NetworkNumber) => CompoundV3AssetData & BaseAdditionalAssetData;
|
|
3
|
+
export declare const formatMarketData: (data: any, network: NetworkNumber, baseAssetPrice: string) => CompoundV3AssetData;
|
|
4
|
+
export declare const formatBaseData: (data: any, network: NetworkNumber, baseAssetPrice: string) => CompoundV3AssetData & BaseAdditionalAssetData;
|
|
5
5
|
export declare const getIncentiveApys: (baseData: CompoundV3AssetData & BaseAdditionalAssetData, compPrice: string) => {
|
|
6
6
|
incentiveSupplyApy: string;
|
|
7
7
|
incentiveBorrowApy: string;
|