@moonwell-fi/moonwell-sdk 0.3.2 → 0.4.0
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/CHANGELOG.md +6 -0
- package/_cjs/actions/core/user-positions/common.js.map +1 -1
- package/_cjs/actions/index.js +3 -1
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/morpho/markets/common.js +2 -0
- package/_cjs/actions/morpho/markets/common.js.map +1 -1
- package/_cjs/actions/morpho/user-rewards/common.js +48 -28
- package/_cjs/actions/morpho/user-rewards/common.js.map +1 -1
- package/_cjs/actions/morpho/vaults/getMorphoVaultSnapshots.js +83 -0
- package/_cjs/actions/morpho/vaults/getMorphoVaultSnapshots.js.map +1 -0
- package/_cjs/client/createActions.js +2 -0
- package/_cjs/client/createActions.js.map +1 -1
- package/_cjs/environments/abis/index.js +3 -1
- package/_cjs/environments/abis/index.js.map +1 -1
- package/_cjs/environments/abis/maximillionAbi.js +67 -0
- package/_cjs/environments/abis/maximillionAbi.js.map +1 -0
- package/_cjs/environments/definitions/moonbeam/contracts.js +1 -0
- package/_cjs/environments/definitions/moonbeam/contracts.js.map +1 -1
- package/_cjs/environments/definitions/moonriver/contracts.js +1 -0
- package/_cjs/environments/definitions/moonriver/contracts.js.map +1 -1
- package/_cjs/environments/types/config.js +3 -0
- package/_cjs/environments/types/config.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_esm/actions/core/user-positions/common.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/morpho/markets/common.js +2 -0
- package/_esm/actions/morpho/markets/common.js.map +1 -1
- package/_esm/actions/morpho/user-rewards/common.js +49 -28
- package/_esm/actions/morpho/user-rewards/common.js.map +1 -1
- package/_esm/actions/morpho/vaults/getMorphoVaultSnapshots.js +76 -0
- package/_esm/actions/morpho/vaults/getMorphoVaultSnapshots.js.map +1 -0
- package/_esm/client/createActions.js +2 -0
- package/_esm/client/createActions.js.map +1 -1
- package/_esm/environments/abis/index.js +2 -1
- package/_esm/environments/abis/index.js.map +1 -1
- package/_esm/environments/abis/maximillionAbi.js +65 -0
- package/_esm/environments/abis/maximillionAbi.js.map +1 -0
- package/_esm/environments/definitions/moonbeam/contracts.js +1 -0
- package/_esm/environments/definitions/moonbeam/contracts.js.map +1 -1
- package/_esm/environments/definitions/moonriver/contracts.js +1 -0
- package/_esm/environments/definitions/moonriver/contracts.js.map +1 -1
- package/_esm/environments/types/config.js +4 -1
- package/_esm/environments/types/config.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_types/actions/core/user-positions/common.d.ts.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/morpho/markets/common.d.ts.map +1 -1
- package/_types/actions/morpho/user-rewards/common.d.ts.map +1 -1
- package/_types/actions/morpho/vaults/getMorphoVaultSnapshots.d.ts +8 -0
- package/_types/actions/morpho/vaults/getMorphoVaultSnapshots.d.ts.map +1 -0
- package/_types/client/createActions.d.ts +2 -0
- package/_types/client/createActions.d.ts.map +1 -1
- package/_types/client/createMoonwellClient.d.ts +8 -0
- package/_types/client/createMoonwellClient.d.ts.map +1 -1
- package/_types/environments/abis/index.d.ts +2 -1
- package/_types/environments/abis/index.d.ts.map +1 -1
- package/_types/environments/abis/maximillionAbi.d.ts +52 -0
- package/_types/environments/abis/maximillionAbi.d.ts.map +1 -0
- package/_types/environments/definitions/moonbeam/contracts.d.ts +1 -0
- package/_types/environments/definitions/moonbeam/contracts.d.ts.map +1 -1
- package/_types/environments/definitions/moonbeam/environment.d.ts +1 -0
- package/_types/environments/definitions/moonbeam/environment.d.ts.map +1 -1
- package/_types/environments/definitions/moonriver/contracts.d.ts +1 -0
- package/_types/environments/definitions/moonriver/contracts.d.ts.map +1 -1
- package/_types/environments/definitions/moonriver/environment.d.ts +1 -0
- package/_types/environments/definitions/moonriver/environment.d.ts.map +1 -1
- package/_types/environments/index.d.ts +2 -0
- package/_types/environments/index.d.ts.map +1 -1
- package/_types/environments/types/config.d.ts +5 -1
- package/_types/environments/types/config.d.ts.map +1 -1
- package/_types/environments/types/contracts.d.ts +2 -1
- package/_types/environments/types/contracts.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/types/morphoMarket.d.ts +1 -0
- package/_types/types/morphoMarket.d.ts.map +1 -1
- package/_types/types/morphoVault.d.ts +11 -0
- package/_types/types/morphoVault.d.ts.map +1 -1
- package/actions/core/user-positions/common.ts +1 -0
- package/actions/index.ts +6 -0
- package/actions/morpho/markets/common.ts +2 -0
- package/actions/morpho/user-rewards/common.ts +59 -34
- package/actions/morpho/vaults/getMorphoVaultSnapshots.ts +135 -0
- package/client/createActions.ts +12 -0
- package/environments/abis/index.ts +2 -0
- package/environments/abis/maximillionAbi.ts +64 -0
- package/environments/definitions/moonbeam/contracts.ts +1 -0
- package/environments/definitions/moonriver/contracts.ts +1 -0
- package/environments/types/config.ts +17 -0
- package/environments/types/contracts.ts +7 -0
- package/errors/version.ts +1 -1
- package/index.ts +5 -1
- package/package.json +1 -1
- package/types/morphoMarket.ts +1 -0
- package/types/morphoVault.ts +12 -0
|
@@ -14,10 +14,7 @@ export async function getUserMorphoRewardsData(params: {
|
|
|
14
14
|
params.account,
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
const assets = await getMorphoAssetsData(
|
|
18
|
-
params.environment.chainId,
|
|
19
|
-
rewards.map((r) => r.asset.address),
|
|
20
|
-
);
|
|
17
|
+
const assets = await getMorphoAssetsData(rewards.map((r) => r.asset.address));
|
|
21
18
|
|
|
22
19
|
const result: (MorphoUserReward | undefined)[] = rewards.map((r) => {
|
|
23
20
|
const asset = assets.find(
|
|
@@ -51,8 +48,8 @@ export async function getUserMorphoRewardsData(params: {
|
|
|
51
48
|
|
|
52
49
|
const uniformReward: MorphoUserReward = {
|
|
53
50
|
type: "uniform-reward",
|
|
54
|
-
chainId: r.
|
|
55
|
-
account: r.
|
|
51
|
+
chainId: r.asset.chain_id,
|
|
52
|
+
account: r.user,
|
|
56
53
|
rewardToken,
|
|
57
54
|
claimableNow,
|
|
58
55
|
claimableNowUsd,
|
|
@@ -63,6 +60,19 @@ export async function getUserMorphoRewardsData(params: {
|
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
case "market-reward": {
|
|
63
|
+
const claimableNow = new Amount(
|
|
64
|
+
BigInt(r.for_supply?.claimable_now || 0),
|
|
65
|
+
rewardToken.decimals,
|
|
66
|
+
);
|
|
67
|
+
const claimableNowUsd = claimableNow.value * (asset.priceUsd || 0);
|
|
68
|
+
|
|
69
|
+
const claimableFuture = new Amount(
|
|
70
|
+
BigInt(r.for_supply?.claimable_next || 0),
|
|
71
|
+
rewardToken.decimals,
|
|
72
|
+
);
|
|
73
|
+
const claimableFutureUsd =
|
|
74
|
+
claimableFuture.value * (asset.priceUsd || 0);
|
|
75
|
+
|
|
66
76
|
const collateralClaimableNow = new Amount(
|
|
67
77
|
BigInt(r.for_collateral?.claimable_now || 0),
|
|
68
78
|
rewardToken.decimals,
|
|
@@ -89,26 +99,42 @@ export async function getUserMorphoRewardsData(params: {
|
|
|
89
99
|
const borrowClaimableFutureUsd =
|
|
90
100
|
borrowClaimableFuture.value * (asset.priceUsd || 0);
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
//Rewards reallocated to vaults are reported as vault rewards
|
|
103
|
+
if (r.reallocated_from) {
|
|
104
|
+
const vaultReward: MorphoUserReward = {
|
|
105
|
+
type: "vault-reward",
|
|
106
|
+
chainId: r.program.chain_id,
|
|
107
|
+
account: r.user,
|
|
108
|
+
vaultId: r.reallocated_from,
|
|
109
|
+
rewardToken,
|
|
110
|
+
claimableNow,
|
|
111
|
+
claimableNowUsd,
|
|
112
|
+
claimableFuture,
|
|
113
|
+
claimableFutureUsd,
|
|
114
|
+
};
|
|
115
|
+
return vaultReward;
|
|
116
|
+
} else {
|
|
117
|
+
const marketReward: MorphoUserReward = {
|
|
118
|
+
type: "market-reward",
|
|
119
|
+
chainId: r.program.chain_id,
|
|
120
|
+
account: r.user,
|
|
121
|
+
marketId: r.program.market_id || "",
|
|
122
|
+
rewardToken,
|
|
123
|
+
collateralRewards: {
|
|
124
|
+
claimableNow: collateralClaimableNow,
|
|
125
|
+
claimableNowUsd: collateralClaimableNowUsd,
|
|
126
|
+
claimableFuture: collateralClaimableFuture,
|
|
127
|
+
claimableFutureUsd: collateralClaimableFutureUsd,
|
|
128
|
+
},
|
|
129
|
+
borrowRewards: {
|
|
130
|
+
claimableNow: borrowClaimableNow,
|
|
131
|
+
claimableNowUsd: borrowClaimableNowUsd,
|
|
132
|
+
claimableFuture: borrowClaimableFuture,
|
|
133
|
+
claimableFutureUsd: borrowClaimableFutureUsd,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
return marketReward;
|
|
137
|
+
}
|
|
112
138
|
}
|
|
113
139
|
case "vault-reward": {
|
|
114
140
|
const claimableNow = new Amount(
|
|
@@ -126,7 +152,7 @@ export async function getUserMorphoRewardsData(params: {
|
|
|
126
152
|
const vaultReward: MorphoUserReward = {
|
|
127
153
|
type: "vault-reward",
|
|
128
154
|
chainId: r.program.chain_id,
|
|
129
|
-
account: r.
|
|
155
|
+
account: r.user,
|
|
130
156
|
vaultId: r.program.vault,
|
|
131
157
|
rewardToken,
|
|
132
158
|
claimableNow,
|
|
@@ -144,7 +170,7 @@ export async function getUserMorphoRewardsData(params: {
|
|
|
144
170
|
}
|
|
145
171
|
|
|
146
172
|
type MorphoRewardsResponse = {
|
|
147
|
-
|
|
173
|
+
user: Address;
|
|
148
174
|
for_borrow: {
|
|
149
175
|
claimable_next: string;
|
|
150
176
|
claimable_now: string;
|
|
@@ -169,10 +195,10 @@ type MorphoRewardsResponse = {
|
|
|
169
195
|
chain_id: number;
|
|
170
196
|
vault: Address;
|
|
171
197
|
};
|
|
172
|
-
asset: { address: Address };
|
|
198
|
+
asset: { address: Address; chain_id: number };
|
|
173
199
|
amount?: { claimable_next: string; claimable_now: string };
|
|
174
200
|
type: "vault-reward" | "market-reward" | "uniform-reward";
|
|
175
|
-
reallocated_from:
|
|
201
|
+
reallocated_from: Address;
|
|
176
202
|
};
|
|
177
203
|
|
|
178
204
|
type MorphoAssetResponse = {
|
|
@@ -195,7 +221,6 @@ async function getMorphoRewardsData(
|
|
|
195
221
|
}
|
|
196
222
|
|
|
197
223
|
async function getMorphoAssetsData(
|
|
198
|
-
chainId: number,
|
|
199
224
|
addresses: Address[],
|
|
200
225
|
): Promise<MorphoAssetResponse[]> {
|
|
201
226
|
const rewardsRequest = await getGraphQL<{
|
|
@@ -204,9 +229,9 @@ async function getMorphoAssetsData(
|
|
|
204
229
|
};
|
|
205
230
|
}>(`
|
|
206
231
|
query {
|
|
207
|
-
assets(where: {address_in:
|
|
208
|
-
.map((a: string) => `"${a}"`)
|
|
209
|
-
.join(",")}]
|
|
232
|
+
assets(where: { address_in:[${uniq(addresses)
|
|
233
|
+
.map((a: string) => `"${a.toLowerCase()}"`)
|
|
234
|
+
.join(",")}]}) {
|
|
210
235
|
items {
|
|
211
236
|
address
|
|
212
237
|
symbol
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import utc from "dayjs/plugin/utc.js";
|
|
4
|
+
import type { MoonwellClient } from "../../../client/createMoonwellClient.js";
|
|
5
|
+
import { getEnvironmentFromArgs, isStartOfDay } from "../../../common/index.js";
|
|
6
|
+
import type {
|
|
7
|
+
MorphoVaultParameterType,
|
|
8
|
+
NetworkParameterType,
|
|
9
|
+
} from "../../../common/types.js";
|
|
10
|
+
import type { Chain, Environment } from "../../../environments/index.js";
|
|
11
|
+
import type { MorphoVaultSnapshot } from "../../../types/morphoVault.js";
|
|
12
|
+
|
|
13
|
+
dayjs.extend(utc);
|
|
14
|
+
|
|
15
|
+
export type GetMorphoVaultSnapshotsParameters<
|
|
16
|
+
environments,
|
|
17
|
+
network extends Chain | undefined,
|
|
18
|
+
> = NetworkParameterType<environments, network> &
|
|
19
|
+
MorphoVaultParameterType<network>;
|
|
20
|
+
|
|
21
|
+
export type GetMorphoVaultSnapshotsReturnType = Promise<MorphoVaultSnapshot[]>;
|
|
22
|
+
|
|
23
|
+
export async function getMorphoVaultSnapshots<
|
|
24
|
+
environments,
|
|
25
|
+
Network extends Chain | undefined,
|
|
26
|
+
>(
|
|
27
|
+
client: MoonwellClient,
|
|
28
|
+
args: GetMorphoVaultSnapshotsParameters<environments, Network>,
|
|
29
|
+
): GetMorphoVaultSnapshotsReturnType {
|
|
30
|
+
const environment = getEnvironmentFromArgs(client, args);
|
|
31
|
+
|
|
32
|
+
if (!environment) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return fetchVaultSnapshots(
|
|
37
|
+
(args as GetMorphoVaultSnapshotsParameters<environments, undefined>)
|
|
38
|
+
.vaultAddress,
|
|
39
|
+
environment,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function fetchVaultSnapshots(
|
|
44
|
+
vaultAddress: string,
|
|
45
|
+
environment: Environment,
|
|
46
|
+
): Promise<MorphoVaultSnapshot[]> {
|
|
47
|
+
const dailyData: VaultDailyData[] = [];
|
|
48
|
+
let hasNextPage = true;
|
|
49
|
+
let endCursor: string | undefined;
|
|
50
|
+
|
|
51
|
+
interface VaultDailyData {
|
|
52
|
+
totalBorrows: number;
|
|
53
|
+
totalBorrowsUSD: number;
|
|
54
|
+
totalSupplies: number;
|
|
55
|
+
totalSuppliesUSD: number;
|
|
56
|
+
totalLiquidity: number;
|
|
57
|
+
totalLiquidityUSD: number;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
while (hasNextPage) {
|
|
62
|
+
const result = await axios.post<{
|
|
63
|
+
data: {
|
|
64
|
+
vaultDailySnapshots: {
|
|
65
|
+
items: VaultDailyData[];
|
|
66
|
+
pageInfo: {
|
|
67
|
+
hasNextPage: boolean;
|
|
68
|
+
endCursor: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}>(environment.indexerUrl, {
|
|
73
|
+
query: `
|
|
74
|
+
query {
|
|
75
|
+
vaultDailySnapshots (
|
|
76
|
+
limit: 365,
|
|
77
|
+
orderBy: "timestamp"
|
|
78
|
+
orderDirection: "desc"
|
|
79
|
+
where: {vaultAddress: "${vaultAddress.toLowerCase()}", chainId: ${environment.chainId}}
|
|
80
|
+
${endCursor ? `after: "${endCursor}"` : ""}
|
|
81
|
+
) {
|
|
82
|
+
items {
|
|
83
|
+
totalBorrows
|
|
84
|
+
totalBorrowsUSD
|
|
85
|
+
totalSupplies
|
|
86
|
+
totalSuppliesUSD
|
|
87
|
+
totalLiquidity
|
|
88
|
+
totalLiquidityUSD
|
|
89
|
+
timestamp
|
|
90
|
+
}
|
|
91
|
+
pageInfo {
|
|
92
|
+
hasNextPage
|
|
93
|
+
endCursor
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
dailyData.push(
|
|
101
|
+
...result.data.data.vaultDailySnapshots.items.filter(
|
|
102
|
+
(f: { timestamp: number }) => isStartOfDay(f.timestamp),
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
hasNextPage = result.data.data.vaultDailySnapshots.pageInfo.hasNextPage;
|
|
106
|
+
endCursor = result.data.data.vaultDailySnapshots.pageInfo.endCursor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (dailyData.length > 0) {
|
|
110
|
+
return dailyData.map((point: VaultDailyData) => {
|
|
111
|
+
const supplied = Number(point.totalSupplies);
|
|
112
|
+
const borrow = Number(point.totalBorrows);
|
|
113
|
+
const borrowUsd = Number(point.totalBorrowsUSD);
|
|
114
|
+
const suppliedUsd = Number(point.totalSuppliesUSD);
|
|
115
|
+
const liquidity = Number(point.totalLiquidity);
|
|
116
|
+
const liquidityUsd = Number(point.totalLiquidityUSD);
|
|
117
|
+
|
|
118
|
+
const result: MorphoVaultSnapshot = {
|
|
119
|
+
vaultAddress: vaultAddress.toLowerCase(),
|
|
120
|
+
chainId: environment.chainId,
|
|
121
|
+
timestamp: point.timestamp * 1000,
|
|
122
|
+
totalSupply: supplied,
|
|
123
|
+
totalSupplyUsd: suppliedUsd,
|
|
124
|
+
totalBorrows: borrow,
|
|
125
|
+
totalBorrowsUsd: borrowUsd,
|
|
126
|
+
totalLiquidity: liquidity,
|
|
127
|
+
totalLiquidityUsd: liquidityUsd,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return result;
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
}
|
package/client/createActions.ts
CHANGED
|
@@ -149,6 +149,11 @@ import {
|
|
|
149
149
|
type GetMorphoVaultReturnType,
|
|
150
150
|
getMorphoVault,
|
|
151
151
|
} from "../actions/morpho/vaults/getMorphoVault.js";
|
|
152
|
+
import {
|
|
153
|
+
type GetMorphoVaultSnapshotsParameters,
|
|
154
|
+
type GetMorphoVaultSnapshotsReturnType,
|
|
155
|
+
getMorphoVaultSnapshots,
|
|
156
|
+
} from "../actions/morpho/vaults/getMorphoVaultSnapshots.js";
|
|
152
157
|
import {
|
|
153
158
|
type GetMorphoVaultsParameters,
|
|
154
159
|
type GetMorphoVaultsReturnType,
|
|
@@ -288,6 +293,12 @@ export type Actions<
|
|
|
288
293
|
getMarketSnapshots: <chain extends Chain | undefined = Chain | undefined>(
|
|
289
294
|
args: GetMarketSnapshotsParameters<environments, chain>,
|
|
290
295
|
) => GetMarketSnapshotsReturnType;
|
|
296
|
+
|
|
297
|
+
getMorphoVaultSnapshots: <
|
|
298
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
299
|
+
>(
|
|
300
|
+
args: GetMorphoVaultSnapshotsParameters<environments, chain>,
|
|
301
|
+
) => GetMorphoVaultSnapshotsReturnType;
|
|
291
302
|
};
|
|
292
303
|
|
|
293
304
|
export const actions = <
|
|
@@ -332,5 +343,6 @@ export const actions = <
|
|
|
332
343
|
getCirculatingSupplySnapshots: (args) =>
|
|
333
344
|
getCirculatingSupplySnapshots(client, args),
|
|
334
345
|
getMarketSnapshots: (args) => getMarketSnapshots(client, args),
|
|
346
|
+
getMorphoVaultSnapshots: (args) => getMorphoVaultSnapshots(client, args),
|
|
335
347
|
};
|
|
336
348
|
};
|
|
@@ -5,6 +5,7 @@ import CoreViewsAbi from "./coreViewsAbi.js";
|
|
|
5
5
|
import GovernanceTokenAbi from "./governanceTokenAbi.js";
|
|
6
6
|
import GovernorAbi from "./governorAbi.js";
|
|
7
7
|
import MarketTokenAbi from "./marketTokenAbi.js";
|
|
8
|
+
import MaximillionAbi from "./maximillionAbi.js";
|
|
8
9
|
import MorphoBlueAbi from "./morphoBlueAbi.js";
|
|
9
10
|
import MorphoBundlerAbi from "./morphoBundlerAbi.js";
|
|
10
11
|
import MorphoPublicAllocatorAbi from "./morphoPublicAllocatorAbi.js";
|
|
@@ -40,4 +41,5 @@ export {
|
|
|
40
41
|
TokenSaleAbi,
|
|
41
42
|
VoteCollectorAbi,
|
|
42
43
|
WrappedNativeTokenAbi,
|
|
44
|
+
MaximillionAbi,
|
|
43
45
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{
|
|
5
|
+
internalType: "contract MGlimmer",
|
|
6
|
+
name: "mGlimmer_",
|
|
7
|
+
type: "address",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
payable: false,
|
|
11
|
+
stateMutability: "nonpayable",
|
|
12
|
+
type: "constructor",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
constant: true,
|
|
16
|
+
inputs: [],
|
|
17
|
+
name: "mGlimmer",
|
|
18
|
+
outputs: [
|
|
19
|
+
{
|
|
20
|
+
internalType: "contract MGlimmer",
|
|
21
|
+
name: "",
|
|
22
|
+
type: "address",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
payable: false,
|
|
26
|
+
stateMutability: "view",
|
|
27
|
+
type: "function",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
constant: false,
|
|
31
|
+
inputs: [
|
|
32
|
+
{
|
|
33
|
+
internalType: "address",
|
|
34
|
+
name: "borrower",
|
|
35
|
+
type: "address",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
name: "repayBehalf",
|
|
39
|
+
outputs: [],
|
|
40
|
+
payable: true,
|
|
41
|
+
stateMutability: "payable",
|
|
42
|
+
type: "function",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
constant: false,
|
|
46
|
+
inputs: [
|
|
47
|
+
{
|
|
48
|
+
internalType: "address",
|
|
49
|
+
name: "borrower",
|
|
50
|
+
type: "address",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
internalType: "contract MGlimmer",
|
|
54
|
+
name: "mGlimmer_",
|
|
55
|
+
type: "address",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
name: "repayBehalfExplicit",
|
|
59
|
+
outputs: [],
|
|
60
|
+
payable: true,
|
|
61
|
+
stateMutability: "payable",
|
|
62
|
+
type: "function",
|
|
63
|
+
},
|
|
64
|
+
] as const;
|
|
@@ -9,6 +9,7 @@ export const contracts = createContractsConfig({
|
|
|
9
9
|
wrappedNativeToken: "WGLMR",
|
|
10
10
|
tokenSale: "0x933fCDf708481c57E9FD82f6BAA084f42e98B60e",
|
|
11
11
|
comptroller: "0x8E00D5e02E65A19337Cdba98bbA9F84d4186a180",
|
|
12
|
+
maximillion: "0xe5Ef9310cC7E3437bAD83466675f24FD62A380c3",
|
|
12
13
|
views: "0xe76C8B8706faC85a8Fbdcac3C42e3E7823c73994",
|
|
13
14
|
oracle: "0xED301cd3EB27217BDB05C4E9B820a8A3c8B665f9",
|
|
14
15
|
governor: "0xfc4DFB17101A12C5CEc5eeDd8E92B5b16557666d",
|
|
@@ -8,6 +8,7 @@ export const contracts = createContractsConfig({
|
|
|
8
8
|
stakingToken: "stkMFAM",
|
|
9
9
|
wrappedNativeToken: "WMOVR",
|
|
10
10
|
comptroller: "0x0b7a0EAA884849c6Af7a129e899536dDDcA4905E",
|
|
11
|
+
maximillion: "0x1650C0AD9483158f9e240fd58d0E173807A80CcC",
|
|
11
12
|
views: "0xb4104C02BBf4E9be85AAa41a62974E4e28D59A33",
|
|
12
13
|
oracle: "0x892bE716Dcf0A6199677F355f45ba8CC123BAF60",
|
|
13
14
|
governor: "0x2BE2e230e89c59c8E20E633C524AD2De246e7370",
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
GovernanceTokenAbi,
|
|
20
20
|
GovernorAbi,
|
|
21
21
|
MarketTokenAbi,
|
|
22
|
+
MaximillionAbi,
|
|
22
23
|
MorphoBlueAbi,
|
|
23
24
|
MorphoBundlerAbi,
|
|
24
25
|
MorphoPublicAllocatorAbi,
|
|
@@ -41,6 +42,7 @@ import type {
|
|
|
41
42
|
GovernanceTokenContractReturnType,
|
|
42
43
|
GovernorContractReturnType,
|
|
43
44
|
MarketTokenContractReturnType,
|
|
45
|
+
MaximillionContractReturnType,
|
|
44
46
|
MorphoBlueContractReturnType,
|
|
45
47
|
MorphoBundlerContractReturnType,
|
|
46
48
|
MorphoPublicAllocatorContractReturnType,
|
|
@@ -86,6 +88,7 @@ export type ContractConfig<tokens> = {
|
|
|
86
88
|
governanceToken?: keyof tokens;
|
|
87
89
|
wrappedNativeToken?: keyof tokens;
|
|
88
90
|
comptroller?: Address;
|
|
91
|
+
maximillion?: Address;
|
|
89
92
|
views?: Address;
|
|
90
93
|
tokenSale?: Address;
|
|
91
94
|
morphoViews?: Address;
|
|
@@ -106,6 +109,7 @@ export type ContractsConfigReturnType = {
|
|
|
106
109
|
governanceToken: TokenContractReturnType;
|
|
107
110
|
wrappedNativeToken: TokenContractReturnType;
|
|
108
111
|
comptroller: ComptrollerContractReturnType;
|
|
112
|
+
maximillion: MaximillionContractReturnType;
|
|
109
113
|
views: CoreViewsContractReturnType;
|
|
110
114
|
tokenSale: TokenSaleContractReturnType;
|
|
111
115
|
morphoViews: MorphoViewsContractReturnType;
|
|
@@ -293,6 +297,9 @@ export const createEnvironmentConfig = <
|
|
|
293
297
|
case "comptroller":
|
|
294
298
|
abi = ComptrollerTokenAbi;
|
|
295
299
|
break;
|
|
300
|
+
case "maximillion":
|
|
301
|
+
abi = MaximillionAbi;
|
|
302
|
+
break;
|
|
296
303
|
case "views":
|
|
297
304
|
abi = CoreViewsAbi;
|
|
298
305
|
break;
|
|
@@ -373,6 +380,11 @@ export const createEnvironmentConfig = <
|
|
|
373
380
|
name,
|
|
374
381
|
"comptroller"
|
|
375
382
|
>]: ComptrollerContractReturnType;
|
|
383
|
+
} & {
|
|
384
|
+
[name in keyof contracts as Extract<
|
|
385
|
+
name,
|
|
386
|
+
"maximillion"
|
|
387
|
+
>]: MaximillionContractReturnType;
|
|
376
388
|
} & {
|
|
377
389
|
[name in keyof contracts as Extract<
|
|
378
390
|
name,
|
|
@@ -513,6 +525,11 @@ export type Environment<
|
|
|
513
525
|
name,
|
|
514
526
|
"comptroller"
|
|
515
527
|
>]: ComptrollerContractReturnType;
|
|
528
|
+
} & {
|
|
529
|
+
[name in keyof contracts as Extract<
|
|
530
|
+
name,
|
|
531
|
+
"maximillion"
|
|
532
|
+
>]: MaximillionContractReturnType;
|
|
516
533
|
} & {
|
|
517
534
|
[name in keyof contracts as Extract<
|
|
518
535
|
name,
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
GovernanceTokenAbi,
|
|
8
8
|
GovernorAbi,
|
|
9
9
|
MarketTokenAbi,
|
|
10
|
+
MaximillionAbi,
|
|
10
11
|
MorphoBlueAbi,
|
|
11
12
|
MorphoBundlerAbi,
|
|
12
13
|
MorphoPublicAllocatorAbi,
|
|
@@ -58,6 +59,12 @@ export type ComptrollerContractReturnType = GetContractReturnType<
|
|
|
58
59
|
Address
|
|
59
60
|
>;
|
|
60
61
|
|
|
62
|
+
export type MaximillionContractReturnType = GetContractReturnType<
|
|
63
|
+
typeof MaximillionAbi,
|
|
64
|
+
PublicClient,
|
|
65
|
+
Address
|
|
66
|
+
>;
|
|
67
|
+
|
|
61
68
|
export type MultiRewardDistributorContractReturnType = GetContractReturnType<
|
|
62
69
|
typeof MultiRewardDistributorAbi,
|
|
63
70
|
PublicClient,
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.
|
|
1
|
+
export const version = '0.4.0'
|
package/index.ts
CHANGED
|
@@ -24,7 +24,11 @@ export type {
|
|
|
24
24
|
MorphoVaultUserPosition,
|
|
25
25
|
} from "./types/morphoUserPosition.js";
|
|
26
26
|
export type { MorphoUserReward } from "./types/morphoUserReward.js";
|
|
27
|
-
export type {
|
|
27
|
+
export type {
|
|
28
|
+
MorphoVault,
|
|
29
|
+
MorphoVaultMarket,
|
|
30
|
+
MorphoVaultSnapshot,
|
|
31
|
+
} from "./types/morphoVault.js";
|
|
28
32
|
export {
|
|
29
33
|
MultichainProposalState,
|
|
30
34
|
ProposalState,
|
package/package.json
CHANGED
package/types/morphoMarket.ts
CHANGED
package/types/morphoVault.ts
CHANGED
|
@@ -35,3 +35,15 @@ export type MorphoVaultMarket = {
|
|
|
35
35
|
totalSuppliedUsd: number;
|
|
36
36
|
rewards: Omit<MorphoReward, "marketId">[];
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
export type MorphoVaultSnapshot = {
|
|
40
|
+
chainId: number;
|
|
41
|
+
vaultAddress: string;
|
|
42
|
+
totalSupply: number;
|
|
43
|
+
totalSupplyUsd: number;
|
|
44
|
+
totalBorrows: number;
|
|
45
|
+
totalBorrowsUsd: number;
|
|
46
|
+
totalLiquidity: number;
|
|
47
|
+
totalLiquidityUsd: number;
|
|
48
|
+
timestamp: number;
|
|
49
|
+
};
|